Skip to content

Commit 184dd6b

Browse files
Improved SNS messages count logic
1 parent 47953a1 commit 184dd6b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/test_end_to_end.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,13 @@ def test_debugger_stop_gpu(request):
190190
The notification had to be triggered by {low_gpu_lambda.handler}.
191191
"""
192192
topic_name = sns_notification_topic_arn.split(':')[-1]
193-
time.sleep(120) # wait for SNS metrics to populate
194-
metrics_count = SSHLog().count_sns_notifications(topic_name, timedelta(minutes=15))
193+
metrics_count = 0
194+
for i in range(1, 10):
195+
metrics_count = SSHLog().count_sns_notifications(topic_name, timedelta(minutes=15))
196+
logging.info(f"Recent SNS notifications received: {metrics_count}")
197+
if metrics_count > 0:
198+
break
199+
time.sleep(30) # wait for SNS metrics to populate
195200
assert metrics_count > 0, 'SNS notification had to be triggered by Low GPU Lambda'
196201

197202

0 commit comments

Comments
 (0)