-
Notifications
You must be signed in to change notification settings - Fork 1.2k
TestURLSession: Fixes for Ubuntu18.04 #1602
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
@swift-ci please test |
@millenomi Could you test this on Ubutntu14.04 if you have some time? |
- For expiry date, prefer maximum-age over expires-date but only use maximum-age for version 1 cookies. - For version 0 cookies only return the first port number, if available.
- Set SO_NOSIGPIPE on the client socket (Darwin) or use send() with flag MSG_NOSIGNAL (Linux). - listen() just after bind()ing. - Close the client socket after writing out the response. - When sending a response with a start delay dont use asyncAfter() with a semaphore, just use Thread.sleep(). - Fix parsing the HTTP request so that all of the header lines are read correctly instead of reading the last header line as the body. - When waiting for the server to become ready, wait for the semaphore with a timeout rather than an indefinite wait(). - Add setUp() to be run before each test class. - For test cases that check the respnse body, check the data is not nil before reading it. - Use 1 server for whole class clifetime. - Use shutdown() to interrupt accept() when shutting down the server.
- Uncomment failing tests that now work, fixes SR-7723 and SR-5751. - Disable TestURLSession.test_cancelTask() as it fails intermittently because the server can respond before the task is cancelled. - Disable TestURLSession.test_simpleUploadWithDelegate() as the server wont read the entire body successfully.
5a1d64b
to
f995719
Compare
@swift-ci please test |
@spevans @ianpartridge Can we merge this PR? |
- Add a delay into the test server response so that the task will always be cancelled before the server returns the complete response.
@swift-ci please test |
1 similar comment
@swift-ci please test |
@shahmishal This PR requires #1610 to be merged first and I still need to fix one more test ( |
Ok I've got those other two merged. |
If we're good to go here, let's merge. |
@swift-ci please test and merge |
I'll do a fix for |
@parkera Shall I try and put together a PR with all of the Ubuntu18 fixes for Swift 4.2 or are you just going to merge |
Good question. If it will be relatively quick to cherry pick these then we should do that now to unblock things. |
Disable test_cancelTask() as this seems to be the failing
task causing the others to fail, re-enable test_taskTimeout().
Ensure the HTTP server is ready before starting a test function
that uses it.
This is a followup to #1599 . Its not a complete fix as
test_cancelTask()
still shows up issues and needs to be fixed.Tested ok on Ubuntu 18.04