Skip to content

Commit 248f674

Browse files
committed
test: increase timing
1 parent 428dc48 commit 248f674

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Tests/RealtimeTests/HeartbeatMonitorTests.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,17 @@ final class HeartbeatMonitorTests: XCTestCase {
5858

5959
await monitor.start()
6060

61-
// Wait for a few heartbeats
62-
try await Task.sleep(nanoseconds: 250_000_000) // 0.25 seconds
61+
// Wait for a few heartbeats - be generous with timing for CI
62+
try await Task.sleep(nanoseconds: 300_000_000) // 0.3 seconds
6363

6464
await monitor.stop()
6565

66-
// Should have sent multiple heartbeats (at least 2 in 0.25s with 0.05s interval)
67-
// Note: Due to Task scheduling delays, we can't guarantee exact timing
66+
// Should have sent multiple heartbeats (at least 2 in 0.3s with 0.05s interval)
67+
// Note: Due to Task scheduling delays in CI, we use conservative expectations
68+
// With 0.05s interval, we expect 0.3s / 0.05s = 6 heartbeats ideally,
69+
// but require only 2 to account for scheduling delays
6870
XCTAssertGreaterThanOrEqual(sentHeartbeats.count, 2, "Should send multiple heartbeats")
71+
6972
// Verify refs increment correctly
7073
for (index, ref) in sentHeartbeats.enumerated() {
7174
XCTAssertEqual(ref, "\(index + 1)", "Refs should increment")

0 commit comments

Comments
 (0)