-
Notifications
You must be signed in to change notification settings - Fork 554
[tests] Ignore NSUrlSessionHandlerTest.DisposeAndRecreateBackgroundSessionHandler if the background session is in use. #24545
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
Conversation
…ssionHandler if the background session is in use.
Hopefully fixes this test failure:
[FAIL] DisposeAndRecreateBackgroundSessionHandler : Second request exception
Expected: null
But was: <System.Net.Http.HttpRequestException: Could not communicate with background transfer service
---> Foundation.NSErrorException: Error Domain=NSURLErrorDomain Code=-996 "Could not communicate with background transfer service" UserInfo={_NSURLErrorRelatedURLSessionTaskErrorKey=(
"BackgroundDataTask <FE008EA4-3168-4E2F-B066-9565EEC47E67>.<1>"
), NSLocalizedDescription=Could not communicate with background transfer service, _NSURLErrorFailingURLSessionTaskErrorKey=BackgroundDataTask <FE008EA4-3168-4E2F-B066-9565EEC47E67>.<1>}
--- End of inner exception stack trace ---
at System.Net.Http.NSUrlSessionHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) in /Users/builder/azdo/_work/4/s/macios/src/Foundation/NSUrlSessionHandler.cs:line 595
at System.Net.Http.HttpClient.GetByteArrayAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken)
at MonoTests.System.Net.Http.NSUrlSessionHandlerTest.<>c.<<DisposeAndRecreateBackgroundSessionHandler>b__0_1>d.MoveNext() in /Users/builder/azdo/_work/1/s/macios/tests/monotouch-test/System.Net.Http/NSUrlSessionHandlerTest.cs:line 47
--- End of stack trace from previous location ---
at TestRuntime.TryRunAsync(TimeSpan timeout, Task startTask, Task completionTask, UIImage imageToShow, Exception& exception) in /Users/builder/azdo/_work/1/s/macios/tests/common/TestRuntime.RunAsync.cs:line 119>
at MonoTests.System.Net.Http.NSUrlSessionHandlerTest.DisposeAndRecreateBackgroundSessionHandler() in /Users/builder/azdo/_work/1/s/macios/tests/monotouch-test/System.Net.Http/NSUrlSessionHandlerTest.cs:line 60
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.
Pull request overview
This PR adds handling for intermittent test failures in NSUrlSessionHandlerTest.DisposeAndRecreateBackgroundSessionHandler when the background transfer service is already in use by another process. The test now ignores these transient failures instead of failing.
Changes:
- Added a helper method to detect and ignore the specific NSUrlError.BackgroundSessionInUseByAnotherProcess exception
- Integrated the helper method into both request validation points in the test
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…ound-service-in-use
✅ [CI Build #35a2421] Build passed (Build packages) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ [PR Build #35a2421] Build passed (Detect API changes) ✅Pipeline on Agent |
✅ [CI Build #35a2421] Build passed (Build macOS tests) ✅Pipeline on Agent |
💻 [CI Build #35a2421] Tests on macOS X64 - Mac Sonoma (14) passed 💻✅ All tests on macOS X64 - Mac Sonoma (14) passed. Pipeline on Agent |
💻 [CI Build #35a2421] Tests on macOS M1 - Mac Monterey (12) passed 💻✅ All tests on macOS M1 - Mac Monterey (12) passed. Pipeline on Agent |
💻 [CI Build #35a2421] Tests on macOS M1 - Mac Ventura (13) passed 💻✅ All tests on macOS M1 - Mac Ventura (13) passed. Pipeline on Agent |
💻 [CI Build #35a2421] Tests on macOS arm64 - Mac Sequoia (15) passed 💻✅ All tests on macOS arm64 - Mac Sequoia (15) passed. Pipeline on Agent |
💻 [CI Build #35a2421] Tests on macOS arm64 - Mac Tahoe (26) passed 💻✅ All tests on macOS arm64 - Mac Tahoe (26) passed. Pipeline on Agent |
✅ API diff for current PR / commitNET (empty diffs)✅ API diff vs stableNET (empty diffs)ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
🚀 [CI Build #35a2421] Test results 🚀Test results✅ All tests passed on VSTS: test results. 🎉 All 117 tests passed 🎉 Tests counts✅ cecil: All 1 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
Hopefully fixes this test failure: