Skip to content

Commit

Permalink
wait for verifications
Browse files Browse the repository at this point in the history
  • Loading branch information
piotr-iohk committed Jan 23, 2024
1 parent de2dca6 commit 5e596b3
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ jobs:
- name: 🔁 E2E Test Start
run: poetry run invoke test start

- name: ⏳ Wait
run: sleep 1500
- name: ⏳ Wait for verifications
run: poetry run invoke test wait

- name: 🧪 E2E Test Run Checks
run: |
Expand Down
38 changes: 38 additions & 0 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ def test(ctx, action):
check_env_vars()
network(ctx, "start")
start_coordinator(ctx)
elif action == "wait":
wait_for_verifications(ctx)
elif action == "stop":
network(ctx, "stop")
stop_coordinator(ctx)
Expand Down Expand Up @@ -488,6 +490,42 @@ def postgres_get_data():
return postgres_submitters, postgres_verified_subs


import time
from datetime import datetime, timedelta


@task(pre=[load_env])
def wait_for_verifications(ctx):
timeout = 60 * 60 # 60 minutes in seconds
start_time = datetime.now()
keyspace_subs = keyspace_get_submissions()
keyspace_verified_subs = [sub for sub in keyspace_subs if sub["verified"]]

while len(keyspace_verified_subs) != len(keyspace_subs):
current_time = datetime.now()
elapsed_time = (current_time - start_time).total_seconds()

# Check if timeout has been reached
if elapsed_time > timeout:
print(
f"Timeout reached: Verified submissions: {len(keyspace_verified_subs)} / {len(keyspace_subs)}"
)
exit(1)

ctx.run("sleep 15", echo=True)

print(
f"Waiting for verifications. Verified submissions: {len(keyspace_verified_subs)} / {len(keyspace_subs)}"
)

keyspace_subs = keyspace_get_submissions()
keyspace_verified_subs = [sub for sub in keyspace_subs if sub["verified"]]

print(
f"All submissions have been verified. {len(keyspace_verified_subs)} / {len(keyspace_subs)}"
)


@task(pre=[load_env])
def assert_data(ctx):
# Get data from Keyspaces
Expand Down

0 comments on commit 5e596b3

Please sign in to comment.