Skip to content

make TestHTTPServer choose the port automatically rather than guessing #1185

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

Merged
merged 1 commit into from
Sep 5, 2017
Merged

make TestHTTPServer choose the port automatically rather than guessing #1185

merged 1 commit into from
Sep 5, 2017

Conversation

weissi
Copy link
Contributor

@weissi weissi commented Aug 22, 2017

the loop to find a free port is ugly, error-prone and makes the tests less robust

let start = 21961
for port in start...(start+100) { //we must find at least one port to bind

fixing this here

@weissi weissi requested a review from pushkarnk August 22, 2017 17:50
this is the same as nthos which is a C macro which isn't available from Swift :\.
*/
static func from(networkByteOrder input: UInt16) -> UInt16 {
var val: UInt16 = input
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this just UInt16(bigEndian:) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, thanks, fixed.

and little endian machines.
Cf. https://commandcenter.blogspot.co.uk/2012/04/byte-order-fallacy.html

this is the same as nthos which is a C macro which isn't available from Swift :\.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a small typo here? did you mean ntohs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, removed as of @spevans comment

@pushkarnk
Copy link
Member

@swift-ci please test

@pushkarnk
Copy link
Member

Test Case 'TestURLSession.test_httpRedirectionTimeout' started at 2017-08-23 07:52:21.900
TestFoundation/TestURLSession.swift:325: error: TestURLSession.test_httpRedirectionTimeout : XCTAssertEqual failed: ("cannotConnectToHost") is not equal to ("timedOut") - Unexpected error code

@weissi
Copy link
Contributor Author

weissi commented Aug 23, 2017

@swift-ci please test

1 similar comment
@weissi
Copy link
Contributor Author

weissi commented Aug 23, 2017

@swift-ci please test

@weissi
Copy link
Contributor Author

weissi commented Aug 23, 2017

@pushkarnk @spevans I'm actually expect the tests to fail in test_httpRedirectionTimeout just I'd also expect them to fail in #1187 . If you're happy I'd temporarily disable test_httpRedirectionTimeout and file an issue to fix it. I volunteer to do that.

@pushkarnk
Copy link
Member

@swift-ci please test and merge

1 similar comment
@pushkarnk
Copy link
Member

@swift-ci please test and merge

@pushkarnk
Copy link
Member

cc @saiHemak

@swift-ci swift-ci merged commit ace3990 into swiftlang:master Sep 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants