Skip to content
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

Fix internet-up.ably-realtime.com checks #961

Merged
merged 7 commits into from
Jan 27, 2020
Merged

Conversation

tcard
Copy link
Contributor

@tcard tcard commented Dec 24, 2019

Run them on each fallback host change, and don't ignore the result.

Fixes #952.

Commit acdb52c supersedes #959 and fixes #931.

The spec says:

> In the case of an error necessitating use of an alternative host
> (see RTN17d), the Connection manager should first check if an internet
> connection is available [...]

Changing fallback hosts is an instance of such an error, not just going
from non-fallback to fallback. It also makes more sense.
@@ -3560,16 +3560,19 @@ class RealtimeClientConnection: QuickSpec {
TestProxyTransport.network = .hostUnreachable
defer { TestProxyTransport.network = nil }

var urlConnections = [NSURL]()
var urls = [NSURL]()
Copy link
Contributor

Choose a reason for hiding this comment

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

We can just use URL instead of NSURL and avoid those casts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed at b13ddb5.

if Optional(fallbackHost) == resultFallbackHosts.last {
continue
}
// Host changed; should've had a internet check before.
Copy link
Contributor

Choose a reason for hiding this comment

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

Small typo: "should've had a internet"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed at 147d7b7.

}
// wss://[a-e].ably-realtime.com: when a 401 occurs because of the `xxxx:xxxx` key
client.connection.once(.failed) { error in
done()
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need a partialDone?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The connection is going to get either to DISCONNECTED or to FAILED. Anyway, it was this way before.

ricardopereira
ricardopereira previously approved these changes Dec 27, 2019
@tcard
Copy link
Contributor Author

tcard commented Jan 2, 2020

CI is failing (sometimes):

[22:54:51]: ▸     ✗ Connection__Host_Fallback__applies_when_the_default_realtime_ably_io_endpoint_is_being_used, expected to have Array<URL> with count 2, got 1
[22:54:51]: ▸     ✗ Connection__Host_Fallback__applies_when_an_array_of_ClientOptions_fallbackHosts_is_provided, expected to be true, got <false>
[22:54:51]: ▸     ✗ Connection__Host_Fallback__every_connection_is_first_attempted_to_the_primary_host_realtime_ably_io, Waited more than 10.0 seconds
[22:54:51]: ▸     ✗ Connection__Host_Fallback__every_connection_is_first_attempted_to_the_primary_host_realtime_ably_io, expected to have Array<URL> with count 3, got 2
[22:54:51]: ▸     ✗ Connection__Host_Fallback__every_connection_is_first_attempted_to_the_primary_host_realtime_ably_io, expected to be true, got <false>
[22:54:51]: ▸     ✗ Connection__Host_Fallback__every_connection_is_first_attempted_to_the_primary_host_realtime_ably_io, Test crashed
[22:54:51]: ▸     ✗ Connection__Host_Fallback__should_retry_hosts_in_random_order_after_checkin_if_an_internet_connection_is_available, expected to equal <[d.ably-realtime.com, e.ably-realtime.com, a.ably-realtime.com, c.ably-realtime.com, b.ably-realtime.com]>, got <[d.ably-realtime.com, e.ably-realtime.com, a.ably-realtime.com, c.ably-realtime.com]>
[22:37:02]: ▸     ✗ Connection__Host_Fallback__should_retry_hosts_in_random_order_after_checkin_if_an_internet_connection_is_available, expected to be true, got <false>

@ricardopereira
Copy link
Contributor

@tcard Does the CI pass in your machine?

ricardopereira
ricardopereira previously approved these changes Jan 17, 2020
@tcard
Copy link
Contributor Author

tcard commented Jan 18, 2020

@tcard Does the CI pass in your machine?

It does, but this really is failing too much on CI. I'll come back to this at some point.

@tcard
Copy link
Contributor Author

tcard commented Jan 26, 2020

CI failures seem unrelated to this fix and just seem related to the general theme of Travis just hanging for too long.

@tcard tcard requested a review from ricardopereira January 26, 2020 09:01
@tcard
Copy link
Contributor Author

tcard commented Jan 26, 2020

Bitrise says this is ✅.

@ricardopereira PTAL, GitHub dismissed your review after a merge commit.

@tcard tcard merged commit 42e8ad6 into develop Jan 27, 2020
@tcard tcard deleted the 952-internet-up-ignored branch January 27, 2020 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Result of internet-up.ably-realtime.com is ignored Flaky test: RTN17* (fallback hosts)
2 participants