Skip to content

Commit f2e4bc9

Browse files
committed
Fix tests
1 parent 9a17c9f commit f2e4bc9

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

.ci/opensearch/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ inputs:
2020
opensearch-initial-admin-password:
2121
description: 'The password for the user admin in your cluster'
2222
required: false
23-
default: 'myStrongPassword123!'
23+
default: 'myStrongPassword_123'
2424

2525
runs:
2626
using: 'docker'

tests/test_opensearch.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ def skip_if_not_github_actions():
2626
def abcd():
2727
"""Set up OpenSearch database connection."""
2828
security_enabled = os.getenv("security_enabled") == "true"
29-
# credential = "admin:myStrongPassword123!"
30-
credential = "admin:admin"
29+
credential = "admin:myStrongPassword_123"
3130

3231
logging.basicConfig(level=logging.INFO)
3332

tests/test_opensearch_mock.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@ def abcd():
1717
"""Set up database connection."""
1818
port = int(os.environ.get("port", 9200))
1919
host = "localhost"
20-
security_enabled = os.getenv("security_enabled") == "true"
21-
# credential = "admin:myStrongPassword123!"
22-
credential = "admin:admin"
20+
# If running in CI, enable/disable security
21+
if os.getenv("GITHUB_ACTIONS") == "true":
22+
security_enabled = os.getenv("security_enabled") == "true"
23+
else:
24+
# Otherwise assume local OpenSearch is enabled
25+
security_enabled = True
26+
27+
credential = "admin:myStrongPassword_123"
2328

2429
logging.basicConfig(level=logging.INFO)
2530

@@ -33,7 +38,7 @@ def abcd():
3338
return opensearch_abcd
3439

3540

36-
def test_destroy(self, abcd):
41+
def test_destroy(abcd):
3742
"""
3843
Test destroying database index.
3944
"""
@@ -42,7 +47,7 @@ def test_destroy(self, abcd):
4247
assert abcd.client.indices.exists("test_index") is False
4348

4449

45-
def test_create(self, abcd):
50+
def test_create(abcd):
4651
"""
4752
Test creating database index.
4853
"""
@@ -52,7 +57,7 @@ def test_create(self, abcd):
5257
assert abcd.client.indices.exists("fake_index") is False
5358

5459

55-
def test_push(self, abcd):
60+
def test_push(abcd):
5661
"""
5762
Test pushing atoms objects to database individually.
5863
"""

0 commit comments

Comments
 (0)