Repository navigation
fix(cloud): keep redialing a new machine until the connect deadline #13981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
b159eff
d1106b3
1d13a27
232e19d
e06d351
968e2fe
50b744a
b717ff4
8cb5cd8
48acbcc
e317f9d
9826cfb
d446cf6
b238619
8a10db0
4d6856b
89114e4
7f7d51d
2d2e148
876ed91
0b5046a
f5b77e1
0c6ea14
139fb75
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -101,6 +101,26 @@ struct CloudPrivateRouteSelectionTests { | |
| == "ws://[fd00::2]:1337/v1/link") | ||
| } | ||
|
|
||
| @Test("Address selection uses the caller's connect budget, not a separate shorter deadline") | ||
| func selectionHonorsTheCallersConnectBudget() async throws { | ||
| let path = "/tmp/cmux-route-\(UUID().uuidString).sock" | ||
| let hub = try CloudLoopbackPortForwardTests.FakeSocksHub(unixSocketPath: path) | ||
| try await hub.start() | ||
| defer { hub.stop() } | ||
| hub.silent = true | ||
| let manager = manager() | ||
| await manager.setPrivateAddresses(["10.16.0.2", "fd00::2"], for: "vm-test") | ||
| let ready = CloudWireGuardHub.Ready(socketPath: path, routes: ["10.16.0.0/24", "fd00::/8"]) | ||
| let started = ContinuousClock.now | ||
|
|
||
| await #expect(throws: (any Error).self) { | ||
| try await manager.resolvedPrivateRoute(machineID: "vm-test", through: ready, timeout: .milliseconds(400)) | ||
| } | ||
| // The link passes its remaining budget here; selection must end on it, | ||
| // not on the connector's own 15 s default. | ||
| #expect(ContinuousClock.now - started < .seconds(3)) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift Remove the wall-clock ceiling from this timeout test. If a loaded runner delays the test task, the three-second assertion can fail even when the connector honors the 400 ms budget. The hidden input is scheduler delay. Inject a virtual clock into the connector used by route selection, advance it to the deadline, and assert the timeout result instead of elapsed time. As per coding guidelines, Test Determinism prohibits “an assertion on a measured wall-clock duration, or a hard absolute latency ceiling on shared CI.” 🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| } | ||
|
|
||
| @Test("A legacy route outside the enrolled network is rejected by the shared resolver") | ||
| func unenrolledLegacyRouteIsRejected() async { | ||
| await #expect(throws: (any Error).self) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift
Make the redial tests independent of scheduler delays. Both tests use real elapsed time to control behavior or assert retry progress. Correct code can fail these tests when CI delays a task. Use a controllable clock for the redial schedule and simulated reachability.
cmuxTests/CloudHubConnectorHedgeTests.swift#L80-L90: advance a fake clock past reachability only after the first attempt has started.cmuxTests/CloudHubConnectorHedgeTests.swift#L73-L74: advance the same clock through specified ticks before asserting the attempt count.As per coding guidelines, “A test must not depend on real wall-clock time.”
📍 Affects 1 file
cmuxTests/CloudHubConnectorHedgeTests.swift#L80-L90(this comment)cmuxTests/CloudHubConnectorHedgeTests.swift#L73-L74🤖 Prompt for AI Agents
Source: Coding guidelines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed that these are wall-clock tests.
hedgedalready takesclock:, so the schedule could be driven by a test clock, but the attempts' simulated reachability (ContinuousClock.now < reachableAt) andTask.sleepwould also have to move onto that clock. The existinglaterAttemptWinsOverStuckEarlyAttemptfrom #13299 has the same shape. The bounds are loose (about 18 expected starts against a floor of 8 inunreachableFailsAtDeadlineWithBoundedAttempts), so I'm treating this as a follow-up for the author rather than a merge blocker. (Leo's maintainer sweep)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@teamleaderleo, agreed. Changing onlyhedged(clock:)would leave simulated reachability and attempt sleeps tied to real time.laterAttemptWinsOverStuckEarlyAttempthas the same issue. I’ll leave this finding open as a non-blocking follow-up. Would you like me to open a GitHub issue for the author?✏️ Learnings added
You are interacting with an AI system.