Skip to content

Commit 6e8fbd8

Browse files
committed
pytests: fix flaky checkpoint sync test
In sync tests, wait until the most recently checkpoint, the one with all the data is synced. This didn't show up previously, as all the data was inserted and executed within the checkpoint interval of 5s, and this checkpoint was synced within the interval of 10s. Signed-off-by: Abhinav Gyawali <22275402+abhizer@users.noreply.github.com>
1 parent e62b91b commit 6e8fbd8

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

python/tests/platform/test_checkpoint_sync.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import sys
44
import time
55
from typing import Optional
6-
from uuid import uuid4
6+
from uuid import uuid4, UUID
77

88
from feldera.enums import FaultToleranceModel, PipelineStatus
99
from feldera.runtime_config import RuntimeConfig, Storage
@@ -144,13 +144,22 @@ def test_checkpoint_sync(
144144
time.sleep(0.5)
145145

146146
print("Checkpoint UUID:", chk_uuid, file=sys.stderr)
147+
time.sleep(1)
147148

148149
if automated_sync_interval is not None:
149150
timeout = time.monotonic() + 30
150151
success = None
151152
while time.monotonic() < timeout and success is None:
152153
try:
153-
success = self.pipeline.last_successful_checkpoint_sync()
154+
synced = self.pipeline.last_successful_checkpoint_sync()
155+
print(
156+
"Automatically synced checkpoint UUID:", synced, file=sys.stderr
157+
)
158+
if synced is not None and chk_uuid is not None:
159+
if synced >= UUID(chk_uuid):
160+
success = synced
161+
else:
162+
success = synced
154163
except RuntimeError:
155164
time.sleep(0.5)
156165
continue
@@ -160,6 +169,9 @@ def test_checkpoint_sync(
160169
)
161170
else:
162171
uuid = self.pipeline.sync_checkpoint(wait=True)
172+
print("Synced Checkpoint UUID:", uuid, file=sys.stderr)
173+
if chk_uuid is not None:
174+
assert UUID(uuid) >= UUID(chk_uuid)
163175

164176
self.pipeline.stop(force=True)
165177

0 commit comments

Comments
 (0)