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 spec failures #506

Merged
merged 14 commits into from
Sep 27, 2016
Merged

Conversation

ricardopereira
Copy link
Contributor

@@ -427,6 +427,7 @@ - (ARTTokenRequest *)tokenRequestFromDictionary:(NSDictionary *)input error:(NSE
[_logger verbose:@"RS:%p ARTJsonLikeEncoder<%@>: tokenRequestFromDictionary %@", _rest, [_delegate formatAsString], input];

if (![input isKindOfClass:[NSDictionary class]]) {
*error = [ARTErrorInfo createWithCode:ARTStateRequestTokenFailed message:@"input provided has an invalid TokenRequest"];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tcard Do you agree with this? I add this check because an authUrl can return an empty object. The lib will try to use that empty object as a TokenRequest and then the callback isn't called because the request is nil.

I have some doubts mostly because the authUrl can return a token or a tokenDetails or even a tokenRequest. Maybe it's important to add a test checking a wrong use of authUrl on each case.

Copy link
Contributor

Choose a reason for hiding this comment

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

If the method that uses authUrl (this one) expects the return to not be nil, then it should be that method the one that checks it, not the decoder. Arguably a nil input being decoded to a nil TokenRequest is correct behavior.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tcard 6b4fb0f.

@@ -904,7 +904,7 @@ class RealtimeClientPresence: QuickSpec {
guard let error = error else {
fail("error expected"); done(); return
}
expect(error.message).to(contain("Channel denied access based on given capability"))
expect(error.message).to(contain("Invalid clientId for credentials"))
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 looked at the lib and I found nothing that could change this behaviour. It seems to be an Ably service change. @tcard what do you think?

Copy link
Member

Choose a reason for hiding this comment

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

That looks like your test is doing something odd with the clientId and changing this error message only indicates that this test is no longer testing "should result in an error if the client does not have required presence permission". Can you enable verbose logging and send us the log to look at, I suspect you're sending an invalid clientId somewhere

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mattheworiordan Fixed a05d086.

@@ -2034,7 +2034,7 @@ class Auth : QuickSpec {

describe("Reauth") {
// RTC8
it("should use authorise({force: true}) to reauth with a token with a different set of capabilities") {
pending("should use authorise({force: true}) to reauth with a token with a different set of capabilities") {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@EvgenyKarkan The re-attach is failing because the channel is in the Failed state. I saw that RTC8 as some subspecs so I assumed that it isn't ready.

Copy link
Member

Choose a reason for hiding this comment

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

@ricardopereira not sure what you mean by some subspecs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mattheworiordan I mean RTC8 is composed by RTC8a1, RTC8a2, RTC8a3, etc. So the test should be complying those but now I noticed that RTC8 is a new spec from v0.9. I will fix #485, the one responsible for failing the test.

@ricardopereira ricardopereira mentioned this pull request Sep 20, 2016
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.

@ricardopereira I'd like to know why you are getting that error now as it appears to me that the test is broken not the realtime system

@@ -2034,7 +2034,7 @@ class Auth : QuickSpec {

describe("Reauth") {
// RTC8
it("should use authorise({force: true}) to reauth with a token with a different set of capabilities") {
pending("should use authorise({force: true}) to reauth with a token with a different set of capabilities") {
Copy link
Member

Choose a reason for hiding this comment

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

@ricardopereira not sure what you mean by some subspecs?

@@ -904,7 +904,7 @@ class RealtimeClientPresence: QuickSpec {
guard let error = error else {
fail("error expected"); done(); return
}
expect(error.message).to(contain("Channel denied access based on given capability"))
expect(error.message).to(contain("Invalid clientId for credentials"))
Copy link
Member

Choose a reason for hiding this comment

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

That looks like your test is doing something odd with the clientId and changing this error message only indicates that this test is no longer testing "should result in an error if the client does not have required presence permission". Can you enable verbose logging and send us the log to look at, I suspect you're sending an invalid clientId somewhere

let channel = client.channels.get("cannotpresence")

waitUntil(timeout: testTimeout) { done in
channel.presence.update(nil) { error in
expect(error!.message).to(contain("Channel denied access based on given capability"))
expect(error!.message).to(contain("Invalid clientId for credentials"))
Copy link
Member

Choose a reason for hiding this comment

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

Same applies here, we should not commit this

let channel = client.channels.get("cannotpresence")

waitUntil(timeout: testTimeout) { done in
channel.presence.leaveClient("other", data: nil) { error in
expect(error!.message).to(contain("Channel denied access based on given capability"))
expect(error!.message).to(contain("Invalid clientId for credentials"))
Copy link
Member

Choose a reason for hiding this comment

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

As above, don't commit

@@ -427,6 +427,7 @@ - (ARTTokenRequest *)tokenRequestFromDictionary:(NSDictionary *)input error:(NSE
[_logger verbose:@"RS:%p ARTJsonLikeEncoder<%@>: tokenRequestFromDictionary %@", _rest, [_delegate formatAsString], input];

if (![input isKindOfClass:[NSDictionary class]]) {
*error = [ARTErrorInfo createWithCode:ARTStateRequestTokenFailed message:@"input provided has an invalid TokenRequest"];
Copy link
Contributor

Choose a reason for hiding this comment

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

If the method that uses authUrl (this one) expects the return to not be nil, then it should be that method the one that checks it, not the decoder. Arguably a nil input being decoded to a nil TokenRequest is correct behavior.

@ricardopereira
Copy link
Contributor Author

Test suite is failing because of the recent version of bundler (v1.13.1).
Bundler issue rubygems/bundler#4981.

@tcard tcard force-pushed the fix-legacy-tests-account-blocked branch from 8d162bf to 7be9767 Compare September 22, 2016 09:39
@tcard tcard force-pushed the fix-legacy-tests-account-blocked branch from 7be9767 to 6ae50a1 Compare September 22, 2016 11:15
@tcard tcard force-pushed the fix-legacy-tests-account-blocked branch from 6ae50a1 to e8e6836 Compare September 22, 2016 11:54
@ricardopereira
Copy link
Contributor Author

@tcard @mattheworiordan Can I merge this?

@ricardopereira ricardopereira merged commit 8bec768 into fix-legacy-tests-account-blocked Sep 27, 2016
@ricardopereira ricardopereira deleted the fix-spec-failures branch September 27, 2016 09:39
ricardopereira added a commit that referenced this pull request Sep 27, 2016
* Test suite: add `testSuite_waitForConnectionToClose`

* Fix testMultipleText_1000_10: increase timeout

* Fix connection broken after connection is closed: should wait for the publishing acknowledgement

* Fix spec failures (#506)

* Test suite: add `testSuite_waitForConnectionToClose`

* Fix testMultipleText_1000_10: increase timeout

* A few fixes in tests.

* Fix connection broken after connection is closed: should wait for the publishing acknowledgement

* Fix spec tests: expects `done` completion closure to only be called once

* Fix: decode each REST presence message data

* Fix RSP5

* Fix: should error if authUrl request is returning incompatible data

* Fix RTP8h, RTP9e, RTP10e: token with clientId

* Fix RTN17e: already closed

* RTC8: pending

* Fix #117 test: add delay

* Enhance RTP5b: wait for presence of Client2

 - sometimes was passing, sometimes not

* Fix InvalidNimbleAPIUsage: nested async expectations are not allowed to avoid creating flaky tests
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.

3 participants