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

RTL7d #209

Merged
merged 5 commits into from
Feb 19, 2016
Merged

RTL7d #209

merged 5 commits into from
Feb 19, 2016

Conversation

ricardopereira
Copy link
Contributor

❌ Not passing.


waitUntil(timeout: testTimeout) { done in
channel.subscribeToName(testMessage.encoded.name) { message, errorInfo in
expect(errorInfo).toNot(beNil())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Test is failing because the errorInfo is nil.

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 believe errorInfo should exist in the API anyway for a message listener, instead an error message will be sent to the logger and the message will still be delivered with last successful decoding and the encoding field. See http://docs.ably.io/client-lib-development-guide/features/#RSL6b. I believe this test is wrong and should be checking that the encoding field is still intact i.e. it could not be decoded, and that an error is logged to the logger (if you can do this)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#204 fixes the callback, right @tcard?
Will be something like:

channel.subscribe(testMessage.encoded.name) { message in ...

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, it does.

@mattheworiordan
Copy link
Member

@ricardopereira this looks good, however this only seems to test the failure condition. Should we not be testing the success condition as well where there is not an error?

let line = logs.reduce("") { $0 + "; " + $1 } //Reduce in one line
expect(line).to(contain("ERROR: ARTDataDecoded failed to decode data as 'bad_encoding_type'"))

done()
Copy link
Contributor

Choose a reason for hiding this comment

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

Not tested: "an ErrorInfo error object is emitted as an error on the Channel". (I guess this means that the error is set in RealtimeChannel.errorReason.)

Copy link
Contributor

Choose a reason for hiding this comment

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

As said in https://github.com/ably/ably-ios/pull/211/files#r53039010:

Although now I think "an error should be emitted on the channel" means that it should be emitted to the channel.on listeners. @mattheworiordan is this right? Should it also be set in RealtimeChannel.errorReason?

@tcard tcard mentioned this pull request Feb 16, 2016
@ricardopereira
Copy link
Contributor Author

@ricardopereira this looks good, however this only seems to test the failure condition. Should we not be testing the success condition as well where there is not an error?

@mattheworiordan I'm checking the data & encoding (https://github.com/ably/ably-ios/pull/209/files#diff-74dac661e35645777f94b2a135363313R641). Shouldn't RSL6a take care of it? Otherwise I need to duplicate the test.

@tcard
Copy link
Contributor

tcard commented Feb 17, 2016

LGTM

@tcard
Copy link
Contributor

tcard commented Feb 17, 2016

Sorry, I see that it's marked as pending. Still not passing?

@ricardopereira
Copy link
Contributor Author

I need to rebase. I will do it soon.

@ricardopereira
Copy link
Contributor Author

@tcard Rebased and now it's failing with an uncaught exception: Unexpected exception raised: ARTRealtimeChannel: error decoding data: Error Domain=io.ably.cocoa Code=0 "decoding failed" UserInfo={NSLocalizedFailureReason=ARTErrorInfo with code 0, message: unknown encoding: 'bad_encoding_type', NSLocalizedDescription=decoding failed}

https://github.com/ably/ably-ios/blob/66b38d811a09846c46c2c2cdffea3f7e3bb4e449/ably-ios/ARTRealtimeChannel.m#L329

But the spec says "If there is an error decoding a message, the message is still delivered" RTL7d

Log is showing:
2016-02-17 17:26:54.858 xctest[20736:4525624] ERROR: ARTRealtimeChannel: error decoding data: Error Domain=io.ably.cocoa Code=0 "decoding failed" UserInfo={NSLocalizedFailureReason=ARTErrorInfo with code 0, message: unknown encoding: 'bad_encoding_type', NSLocalizedDescription=decoding failed}

waitUntil(timeout: testTimeout) { done in
let logTime = NSDate()

channel.on(.Failed) { errorInfo in
Copy link
Member

Choose a reason for hiding this comment

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

I realise we are not emitting events here, but the channel should not become failed, so this test is wrong. We don't expect this behaviour.

@tcard
Copy link
Contributor

tcard commented Feb 18, 2016

@ricardopereira So, mark as pending if it's not passing, right?

@ricardopereira
Copy link
Contributor Author

Done

@mattheworiordan
Copy link
Member

LGTM

@ricardopereira ricardopereira merged commit b95603b into master Feb 19, 2016
@ricardopereira ricardopereira deleted the RTL7d branch February 24, 2016 06:59
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