Repository navigation
test(zero-swift): make the lifecycle tests' process connect once before the first test - #285
Merged
Merged
Conversation
…re the first test AppLifecycleTests.hiddenDisconnectsAndShownReconnects (and once hiddenWhileConnecting) failed in the iOS Simulator step of "Swift end-to-end (macOS)": the first connect never reached the test's server within connectWait. On CI the step runs while the simulator's first boot keeps the 3-core runner's load average at 150-470 for minutes. A process's first URLSession connect waits, before its socket opens, on what the system's services (cfprefsd, containermanagerd, runningboardd, configd_sim) set up once per process, and the simulator's unified log on CI showed that taking from about a second to about 30 s. The process's later connects don't wait for it: the second test took 0.15-0.25 s in 37 of 38 probe runs. Waiting for the simulator's boot to finish, stopping zero-cache and Postgres, or a job of its own didn't take the first connect's delay away. The suite now makes the process's first connect once, before its first test, and the tests' waits start after it. URLSession's request timeout (60 s) bounds it, within the first test's 2-minute time limit. Stopping the simulator's configd_sim for the first 30 s of the test process failed main 3 of 3 times (the first test at 12.5 s) and passes now 3 of 3, with a 45 s stop too. Amp-Thread-ID: https://ampcode.com/threads/T-01a22e8b-3956-7364-87ad-1c52739ad938 Co-authored-by: tmm <tmm@tmm.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the recurring
AppLifecycleTests.hiddenDisconnectsAndShownReconnects(and oncehiddenWhileConnecting) flake in the iOS Simulator step of Swift end-to-end (macOS), which failed on #274, #282 and #283. Test-only, so no changeset.Cause
The step runs while the simulator's first boot keeps the 3-core runner's load average at 150–470 for minutes. Before a process's first URLSession connect opens its socket, it waits on one-time setup in system services: cfprefsd, containermanagerd, the runningboardd handshake, and configd_sim's proxy lookup. On CI that took from about 1 s to about 30 s, and the 3 failures since #235 (3 of 48 runs) were all this first connect running past the test's 12.5 s
connectWait. The process's later connects don't wait for it: the second test took 0.15–0.25 s in 37 of 38 probe runs.It is not a client bug, and the test's loopback server isn't involved: the time goes to system services before the socket exists. It also isn't what #235 fixed; that step already runs with
OS_ACTIVITY_MODE=disable.Evidence:
macos-26show the wait.configd_simas the test process starts reproduces the CI failure line for line, and a sample shows the connect blocked inSCDynamicStoreCopyProxies.These didn't remove the stall on CI, which is why the fix is in the test:
simctl bootstatus -bfirstFix
AppLifecycleTestsmakes the process's first connect once, to a loopback server of its own, before its first test, and logs how long it took. The tests' waits start after it, and every test keeps its current wait limits. URLSession's request timeout (60 s) bounds the warm-up, within the first test's 2-minute limit. If it fails, every test fails at once with its error.Verification
The request timed out.swift test --filter AppLifecycleTestspasses with a 16 ms warm-up, andswift format lint --strictpasses.