Skip to content

Commit e539c21

Browse files
debug: docker compose tests fail;
1 parent e6b9a42 commit e539c21

File tree

2 files changed

+96
-69
lines changed

2 files changed

+96
-69
lines changed

tests/executor.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ def wait_for_containers(self, count, label=None, name=None, timeout=500):
128128
'''
129129
NOTE: This helper method can only be used for `compose up` scenarios where self.project_name is defined
130130
'''
131+
print(f"now WAITING for CONTAINERS to be UP")
131132
start = time.time()
132133
end = start
133134
# Wait
@@ -148,15 +149,25 @@ def wait_for_containers(self, count, label=None, name=None, timeout=500):
148149
output = self.client.logs(container["Id"], tail=5)
149150
if "unable to" in output or "denied" in output or "splunkd.pid file is unreadable" in output:
150151
self.logger.error("Container {} did not start properly, last log line: {}".format(container["Names"][0], output))
152+
print(f"SCRIPT FAILS TO CREATE CONTAINER")
153+
sys.exit(1)
151154
elif "Ansible playbook complete" in output:
155+
print(f"ANSIBLE EXEC COMPLETE")
152156
self.logger.info("Container {} is ready".format(container["Names"][0]))
153157
healthy_count += 1
158+
else:
159+
print(f"IN ELSE WHICH WAS NOT EXPECTED:")
160+
print("-------- START LOG ----------")
161+
print(output)
162+
print("-------- END LOG ----------")
154163
else:
164+
print("ALL GOOD ELSE")
155165
self.logger.info("Container {} is ready".format(container["Names"][0]))
156166
healthy_count += 1
157167
if healthy_count == count:
158168
self.logger.info("All containers ready to proceed")
159169
break
170+
print(f"continue for loop without break")
160171
time.sleep(5)
161172
end = time.time()
162173
return True
@@ -222,7 +233,12 @@ def _run_splunk_query(self, container_id, query, username="admin", password="pas
222233
def compose_up(self, defaults_url=None, apps_url=None):
223234
container_count = self.get_number_of_containers(os.path.join(self.SCENARIOS_DIR, self.compose_file_name))
224235
command = "docker compose -p {} -f test_scenarios/{} up -d".format(self.project_name, self.compose_file_name)
236+
print(f"LOOK AT THIS COMMAND")
237+
print(command)
238+
import sys
239+
sys.exit(1)
225240
out, err, rc = self._run_command(command, defaults_url, apps_url)
241+
print("COMPLETED DOCKER COMPOSE")
226242
return container_count, rc
227243

228244
def extract_json(self, container_name):

0 commit comments

Comments
 (0)