Skip to content

Commit

Permalink
chore: faster failure for testinfra AMI
Browse files Browse the repository at this point in the history
  • Loading branch information
pcnc committed Dec 5, 2023
1 parent 32452a5 commit 7b595a7
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions testinfra/test_ami.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
from ec2instanceconnectcli.EC2InstanceConnectKey import EC2InstanceConnectKey
from time import sleep

RUN_ID = os.environ.get("GITHUB_RUN_ID", "unknown-ci-run")
# if GITHUB_RUN_ID is not set, use a default value that includes the user and hostname
RUN_ID = os.environ.get("GITHUB_RUN_ID", "unknown-ci-run-" + os.environ.get("USER", "unknown-user") + '@' + socket.gethostname())

postgresql_schema_sql_content = """
ALTER DATABASE postgres SET "app.settings.jwt_secret" TO 'my_jwt_secret_which_is_not_so_secret';
Expand Down Expand Up @@ -268,17 +269,17 @@ def is_healthy(host) -> bool:
logger.warning("pg not ready")
return False

cmd = host.run(f"curl -sf -k https://localhost:8085/health -H 'apikey: {supabase_admin_key}'")
cmd = host.run(f"curl -sf -k --connect-timeout 30 --max-time 60 https://localhost:8085/health -H 'apikey: {supabase_admin_key}'")
if cmd.failed is True:
logger.warning("adminapi not ready")
return False

cmd = host.run("curl -sf http://localhost:3001/ready")
cmd = host.run("curl -sf --connect-timeout 30 --max-time 60 http://localhost:3001/ready")
if cmd.failed is True:
logger.warning("postgrest not ready")
return False

cmd = host.run("curl -sf http://localhost:8081/health")
cmd = host.run("curl -sf --connect-timeout 30 --max-time 60 http://localhost:8081/health")
if cmd.failed is True:
logger.warning("gotrue not ready")
return False
Expand Down

0 comments on commit 7b595a7

Please sign in to comment.