Skip to content

Commit 072b427

Browse files
committed
TST: wait for startup of save-and-restore service
1 parent f89e3c6 commit 072b427

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

container/start-save-and-restore.sh

100644100755
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ set -x
22

33
python create_env_file.py
44
sudo docker compose -f save-and-restore.yml up -d
5+
python wait_for_startup.py
56

67
# Wait until the service is started.
7-
sleep 30
8+
#sleep 30

container/wait_for_startup.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import time
2+
3+
import httpx
4+
5+
t_wait = 30
6+
BASE_URL = "http://localhost:8080/save-restore"
7+
root_node_uid = "44bef5de-e8e6-4014-af37-b8f6c8a939a2"
8+
9+
if __name__ == "__main__":
10+
t_start = time.time()
11+
while time.time() - t_start < t_wait:
12+
client = httpx.Client(base_url=BASE_URL, timeout=1)
13+
url = f"/node/{root_node_uid}"
14+
response = client.request("GET", url)
15+
if response.status_code == 200:
16+
exit(0)
17+
18+
exit(1)

0 commit comments

Comments
 (0)