diff --git a/scripts/reconcile_track.py b/scripts/reconcile_track.py index 6095d0a2..3d43f91f 100644 --- a/scripts/reconcile_track.py +++ b/scripts/reconcile_track.py @@ -303,6 +303,16 @@ def single(check): ) +def healthy(service, seconds=90): + container = compose("ps", "-q", service).strip() + probe = ["docker", "inspect", "-f", "{{.State.Health.Status}}", container] + deadline = time.monotonic() + seconds + while must(probe).strip() != "healthy": + if time.monotonic() > deadline: + raise SystemExit(f"{service} is not healthy after {seconds} s") + time.sleep(1) + + def interrupt(check): name = f"lab4-reconcile-sigterm-{os.getpid()}" compose("pause", "s3") @@ -322,7 +332,7 @@ def interrupt(check): code = runner.wait(timeout=60) finally: compose("unpause", "s3") - compose("up", "-d", "--wait", "--no-deps", "s3") + healthy("s3") after = reconcile("--dry-run", *FLAGS) status, init = state.split() report = {