diff --git a/.gitattributes b/.gitattributes index 4209e671..beda37c9 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,3 +3,4 @@ *.sql text eol=lf *.yaml text eol=lf *.cfg text eol=lf +evidence/* -whitespace diff --git a/scripts/verify.py b/scripts/verify.py index b7be4da3..1f64f93b 100644 --- a/scripts/verify.py +++ b/scripts/verify.py @@ -66,12 +66,27 @@ def main(): print("Checking short session expiry and indexed history", flush=True) ttl_name = config["name"] + "-ttl-check" assert not command(["docker", "ps", "-a", "--filter", "name=^/" + ttl_name + "$", "--format", "{{.ID}}"]) + created = False try: - compose("run", "-d", "--no-deps", "--name", ttl_name, "-e", "SESSION_TTL_SECONDS=2", "api") + try: + compose("run", "-d", "--no-deps", "--name", ttl_name, + "-e", "SESSION_TTL_SECONDS=2", "api", timeout=45) + except subprocess.TimeoutExpired: + # A detached Compose command on Desktop can time out after Docker + # already started its container. Inspect the unique name rather + # than create another process or treat an unknown startup as PASS. + row = json.loads(command(["docker", "inspect", ttl_name]))[0] + labels = row["Config"]["Labels"] + assert labels["com.docker.compose.project"] == config["name"] + assert labels["com.docker.compose.service"] == "api" + assert "SESSION_TTL_SECONDS=2" in row["Config"]["Env"] + assert row["State"]["Running"], "TTL container did not start" + created = True checks("expiry.txt", "env", "EXPIRY_BASE_URL=http://" + ttl_name + ":8080", "python", "scripts/check_expiry.py") finally: - command(["docker", "stop", "--time", "6", ttl_name]) - command(["docker", "rm", ttl_name]) + if created: + command(["docker", "stop", "--time", "6", ttl_name]) + command(["docker", "rm", ttl_name]) checks("explain-run.txt", "make", "explain") checks("smoke-final.txt", "make", "test") saved("published-smoke.txt", [sys.executable, "-X", "utf8", "tests/smoke.py", "--base-url", base_url])