Skip to content

Commit

Permalink
chore: print debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
pcnc committed Dec 4, 2023
1 parent 6f3c375 commit 28882ca
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions testinfra/test_all_in_one.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ def host():
"--load",
"--tag",
all_in_one_image_tag,
"--cache-from",
"supabase/postgres:aio-15.1.0.136",
path.join(path.dirname(__file__), ".."),
]
)
Expand All @@ -63,11 +65,17 @@ def get_health(container: Container) -> str:
inspect_results = docker_client.api.inspect_container(container.name)
return inspect_results["State"]["Health"]["Status"]

attempts = 0
while True:
health = get_health(container)
if health == "healthy":
break
sleep(1)
attempts += 1
if attempts > 30:
# print container logs for debugging
print(container.logs().decode("utf-8"))
raise TimeoutError("Container failed to become healthy.")

# return a testinfra connection to the container
yield testinfra.get_host("docker://" + cast(str, container.name))
Expand Down

0 comments on commit 28882ca

Please sign in to comment.