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

RSC15a as a part of 0.9 #501

Merged
merged 12 commits into from
Sep 28, 2016
Merged

RSC15a as a part of 0.9 #501

merged 12 commits into from
Sep 28, 2016

Conversation

EvgenyKarkan
Copy link
Contributor

Please review and merge if everything looks good.

Copy link
Member

@mattheworiordan mattheworiordan left a comment

Choose a reason for hiding this comment

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

LGTM 👍

expect(resultFallbackHosts).to(equal(expectedFallbackHosts))
}

it("until httpMaxRetryCount has been reached, if an empty array of fallback hosts is provided, then fallback host functionality is disabled, use defaults instead") {
Copy link
Member

Choose a reason for hiding this comment

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

I don't think is right. If an empty array or fallback hosts is configured, then according to http://docs.ably.io/client-lib-development-guide/features/#RSC15a, If an empty array of fallback hosts is provided, then fallback host functionality is disabled. It appears that you are instead using the defaults?

Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I see this is fixed in b0ae3c6

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see this is fixed in b0ae3c6

Yes, exactly, thanks for feedback.

expect(resultFallbackHosts).to(equal(expectedFallbackHosts))
}

it("until all fallback hosts have been tried, if an empty array of fallback hosts is provided, then fallback host functionality is disabled, use defaults instead") {
Copy link
Member

Choose a reason for hiding this comment

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

Same problem here, it appears you are using the defaults instead of disabling the fallback functionality

@tcard tcard changed the base branch from RSC15b to master September 21, 2016 12:43
@tcard tcard force-pushed the RSC15a branch 3 times, most recently from 0f4462f to 94426c2 Compare September 21, 2016 14:42
Copy link
Member

@mattheworiordan mattheworiordan left a comment

Choose a reason for hiding this comment

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

One small comment otherwise 👍


it("until httpMaxRetryCount has been reached, if custom fallback hosts are provided in ClientOptions#fallbackHosts, then they will be used instead") {
let options = ARTClientOptions(key: "xxxx:xxxx")
options.httpMaxRetryCount = 5
Copy link
Member

Choose a reason for hiding this comment

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

Given you've provided 5, why not set this to 4 for example to ensure that httpMaxRetryCount is working as opposed to the max of hosts available is being used?

@EvgenyKarkan
Copy link
Contributor Author

Please review and merge if everything looks good.

@EvgenyKarkan
Copy link
Contributor Author

@mattheworiordan could you please find some spare time to take a look at 1cef166 ?

Copy link
Member

@mattheworiordan mattheworiordan left a comment

Choose a reason for hiding this comment

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

Like the reduce in retry count but not sure I understand the test logic now using fallbackHosts when the max retry count is the definitive number of retry attempts?

@@ -839,6 +839,7 @@ class RestClient: QuickSpec {
}

expect(testHTTPExecutor.requests).to(haveCount(Int(1 + options.httpMaxRetryCount)))
expect((testHTTPExecutor.requests.count) < (_fallbackHosts.count + 1)).to(beTrue())
Copy link
Member

Choose a reason for hiding this comment

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

Why not expect(testHTTPExecutor.requests).to(haveCount(Int(1 + options.httpMaxRetryCount))) though?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree, I'm using local variable _fallbackHosts and its count property.
Assert based on that hard-coded array is useless, because who knows, how big an array can be.

If I use assert based on options.fallbackHosts.count like that:
expect((testHTTPExecutor.requests.count) < (options.fallbackHosts.count + 1)).to(beTrue())

I can check that count of executed requests (which is 5 = 1 to primary host + 4 to fallback hosts, cuz I use httpMaxRetryCount = 4 value) is less than max available count (which is 6 = 1 to primary + 5 to fallback hosts).

So I just wanted to be sure that reduce in retry count from 5 to 4 - works as expected, does it make sense @mattheworiordan ?

Copy link
Contributor

Choose a reason for hiding this comment

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

@EvgenyKarkan on that line you're checking the _fallbackHosts, not the options.fallbackHosts. You already verifying the number of requests of the testHTTPExecutor and the _fallbackHosts is a local var of the test suite that we control, so I think that line is useless.

@ricardopereira
Copy link
Contributor

Rebased and tests are passing.

@ricardopereira ricardopereira merged commit 8bce6ac into master Sep 28, 2016
@ricardopereira ricardopereira deleted the RSC15a branch September 28, 2016 16:17
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.

4 participants