-
Notifications
You must be signed in to change notification settings - Fork 25
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
Fix spec failures #506
Conversation
@@ -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"]; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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")) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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") { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this 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") { |
There was a problem hiding this comment.
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")) |
There was a problem hiding this comment.
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")) |
There was a problem hiding this comment.
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")) |
There was a problem hiding this comment.
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"]; |
There was a problem hiding this comment.
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.
Test suite is failing because of the recent version of |
148702f
to
e0b308c
Compare
8d162bf
to
7be9767
Compare
e0b308c
to
ef767c7
Compare
7be9767
to
6ae50a1
Compare
ef767c7
to
54f5856
Compare
6ae50a1
to
e8e6836
Compare
… publishing acknowledgement
54f5856
to
e8a399d
Compare
- sometimes was passing, sometimes not
…to avoid creating flaky tests
68398ef
to
62d3610
Compare
@tcard @mattheworiordan Can I merge this? |
* 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
Executed 541 tests, with 0 failures (0 unexpected) in 246.092 (247.119) seconds
Merge this before #505.