Repository navigation
Keep storage tests off the real network - #454
Merged
Merged
Conversation
testMemoryStorageRolloff and testMemoryStorageStress used the real network; a slow request kept Analytics alive past waitUntilFinished's timeout. Give them RestrictedHTTPSession. On a busy runner the stress tests' faked uploads can still hit URLSession's timeout. The batch stays in storage and is resent, so don't fail the test on that error.
bsneed
approved these changes
Oct 20, 2026
URLSession's resource timeout still applies to URLProtocol-faked requests, so a busy runner could fail uploads with -1001. InstantHTTPSession answers without URLSession, so the stress tests keep their strict error handlers.
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 remaining flaky timeouts in
StorageTests.testMemoryStorageRolloffandStressTestson Swift CI.testMemoryStorageRolloffset nohttpSession, so it hit the real network. A slow request keeps theAnalyticsinstance alive pastwaitUntilFinished's 30s window. It now usesRestrictedHTTPSession.URLProtocol, but URLSession's 30s resource timeout still applies to those requests. On a busy runner some uploads went unanswered that long and failed with-1001, which the error handler reports as a storage failure. They now use a newInstantHTTPSessionthat answers with a 200 without going through URLSession, so there are no timers to expire.testMemoryStorageStressalso used the real network and gets the same session.InstantHTTPSessionfollowsURLSessionTask's lifecycle (nothing happens untilresume(),.runninguntil the completion runs) soSegmentDestination's pending-upload tracking behaves as it does with a real session. File uploads still read the batch file.Verified:
TimedOutErroras CI. It passes with the change.