Skip to content

Commit f522a05

Browse files
committed
Ensure we have at least one snapshot for baseline
1 parent d5f9600 commit f522a05

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

tests/e2e_operations.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3069,10 +3069,20 @@ def get_snapshot_count(net):
30693069

30703070
return len(os.listdir(snapshots_dir))
30713071

3072+
def wait_for_at_least_one(net):
3073+
timeout_s = 10
3074+
end_time = time.time() + timeout_s
3075+
while time.time() < end_time:
3076+
if get_snapshot_count(net) > 0:
3077+
return
3078+
3079+
time.sleep(0.1)
3080+
raise TimeoutError(f"Expected at least one snapshot after {timeout_s}s")
3081+
30723082
# min_tx set low
30733083
with net_with_min_tx("_low", 0) as net:
30743084
LOG.info("Started")
3075-
baseline = get_snapshot_count(net)
3085+
baseline = wait_for_at_least_one(net)
30763086
LOG.info("Got snapshot count")
30773087
time.sleep(10)
30783088
after = get_snapshot_count(net)
@@ -3082,7 +3092,7 @@ def get_snapshot_count(net):
30823092

30833093
# min_tx set just right
30843094
with net_with_min_tx("_exact", 2) as net:
3085-
baseline = get_snapshot_count(net)
3095+
baseline = wait_for_at_least_one(net)
30863096
time.sleep(10)
30873097
after = get_snapshot_count(net)
30883098
assert (
@@ -3091,7 +3101,7 @@ def get_snapshot_count(net):
30913101

30923102
# set much higher to show that
30933103
with net_with_min_tx("_high", 10) as net:
3094-
baseline = get_snapshot_count(net)
3104+
baseline = wait_for_at_least_one(net)
30953105
time.sleep(10)
30963106
after = get_snapshot_count(net)
30973107
assert (

0 commit comments

Comments
 (0)