Skip to content

Commit 9c5b3f2

Browse files
authored
Fixing CI broken tests (#425)
1 parent ab92b0a commit 9c5b3f2

File tree

3 files changed

+24
-12
lines changed

3 files changed

+24
-12
lines changed

test_scenarios/2idx2sh1cm.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ services:
2020
- SPLUNK_SEARCH_HEAD_URL=sh1,sh2
2121
- SPLUNK_CLUSTER_MASTER_URL=cm1
2222
- SPLUNK_ROLE=splunk_search_head
23+
- SPLUNK_IDXC_PASS4SYMMKEY=asdf1234
2324
- SPLUNK_LICENSE_URI
2425
- DEBUG=true
2526
- SPLUNK_PASSWORD
@@ -41,6 +42,7 @@ services:
4142
- SPLUNK_SEARCH_HEAD_URL=sh1,sh2
4243
- SPLUNK_CLUSTER_MASTER_URL=cm1
4344
- SPLUNK_ROLE=splunk_search_head
45+
- SPLUNK_IDXC_PASS4SYMMKEY=asdf1234
4446
- SPLUNK_LICENSE_URI
4547
- DEBUG=true
4648
- SPLUNK_PASSWORD
@@ -62,6 +64,7 @@ services:
6264
- SPLUNK_SEARCH_HEAD_URL=sh1,sh2
6365
- SPLUNK_CLUSTER_MASTER_URL=cm1
6466
- SPLUNK_ROLE=splunk_cluster_master
67+
- SPLUNK_IDXC_PASS4SYMMKEY=asdf1234
6568
- SPLUNK_LICENSE_URI
6669
- DEBUG=true
6770
- SPLUNK_PASSWORD
@@ -83,6 +86,7 @@ services:
8386
- SPLUNK_SEARCH_HEAD_URL=sh1,sh2
8487
- SPLUNK_CLUSTER_MASTER_URL=cm1
8588
- SPLUNK_ROLE=splunk_indexer
89+
- SPLUNK_IDXC_PASS4SYMMKEY=asdf1234
8690
- SPLUNK_LICENSE_URI
8791
- DEBUG=true
8892
- SPLUNK_PASSWORD
@@ -104,6 +108,7 @@ services:
104108
- SPLUNK_SEARCH_HEAD_URL=sh1,sh2
105109
- SPLUNK_CLUSTER_MASTER_URL=cm1
106110
- SPLUNK_ROLE=splunk_indexer
111+
- SPLUNK_IDXC_PASS4SYMMKEY=asdf1234
107112
- SPLUNK_LICENSE_URI
108113
- DEBUG=true
109114
- SPLUNK_PASSWORD

test_scenarios/2idx2sh1cm_idx3.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ services:
2020
- SPLUNK_SEARCH_HEAD_URL=sh1,sh2
2121
- SPLUNK_CLUSTER_MASTER_URL=cm1
2222
- SPLUNK_ROLE=splunk_indexer
23+
- SPLUNK_IDXC_PASS4SYMMKEY=asdf1234
2324
- SPLUNK_LICENSE_URI
2425
- SPLUNK_PASSWORD
2526
- DEBUG=true

tests/test_distributed_splunk_image.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ def test_compose_3idx1cm1dmc(self):
552552
container_count, rc = self.compose_up()
553553
assert rc == 0
554554
# Wait for containers to come up
555-
assert self.wait_for_containers(container_count, label="com.docker.compose.project={}".format(self.project_name))
555+
assert self.wait_for_containers(container_count, label="com.docker.compose.project={}".format(self.project_name), timeout=900)
556556
containers = self.client.containers(filters={"label": "com.docker.compose.project={}".format(self.project_name)})
557557
self.check_dmc(containers, 4, 3, 2, 1, 5)
558558

@@ -642,7 +642,7 @@ def test_compose_2idx2sh1cm(self):
642642
container_count, rc = self.compose_up()
643643
assert rc == 0
644644
# Wait for containers to come up
645-
assert self.wait_for_containers(container_count, label="com.docker.compose.project={}".format(self.project_name))
645+
assert self.wait_for_containers(container_count, label="com.docker.compose.project={}".format(self.project_name), timeout=600)
646646
# Get container logs
647647
container_mapping = {"sh1": "sh", "sh2": "sh", "idx1": "idx", "idx2": "idx", "cm1": "cm"}
648648
for container in container_mapping:
@@ -687,25 +687,31 @@ def test_compose_2idx2sh1cm(self):
687687
assert len(idx_list) == 0 and len(sh_list) == 0
688688
# Add one more indexer
689689
self.compose_file_name = "2idx2sh1cm_idx3.yaml"
690-
container_count, rc = self.compose_up()
690+
_, rc = self.compose_up()
691691
assert rc == 0
692692
# Wait for containers to come up
693-
assert self.wait_for_containers(container_count, name="idx3")
693+
assert self.wait_for_containers(container_count+1, label="com.docker.compose.project={}".format(self.project_name), timeout=600)
694694

695695
retries = 10
696696
for n in range(retries):
697-
status, content = self.handle_request_retry("GET", "https://localhost:{}/services/cluster/master/peers?output_mode=json".format(splunkd_port),
697+
try:
698+
status, content = self.handle_request_retry("GET", "https://localhost:{}/services/cluster/master/peers?output_mode=json".format(splunkd_port),
698699
{"auth": ("admin", self.password), "verify": False})
699-
assert status == 200
700-
output = json.loads(content)
701-
for idx in output["entry"]:
702-
if idx["content"]["label"] == "idx3" and idx["content"]["status"] == "Up":
703-
break
704-
else:
700+
assert status == 200
701+
output = json.loads(content)
702+
assert len(output["entry"]) == 3
703+
indexers = []
704+
for idx in output["entry"]:
705+
indexers.append(idx["content"]["label"])
706+
assert "idx1" in indexers
707+
assert "idx2" in indexers
708+
assert "idx3" in indexers
709+
break
710+
except Exception as err:
705711
time.sleep(10)
706712
if n < retries-1:
707713
continue
708-
assert False
714+
raise err
709715

710716
def test_compose_1deployment1cm(self):
711717
self.project_name = self.generate_random_string()

0 commit comments

Comments
 (0)