ably-cocoa icon indicating copy to clipboard operation
ably-cocoa copied to clipboard

Understand and refactor "test__081__Channel__publish__Connection_state_conditions__the_message__should_NOT_be_queued_..._ATTACHED"

Open maratal opened this issue 2 years ago • 1 comments

The test "test__081__Channel__publish__Connection_state_conditions__the_message__should_NOT_be_queued_instead_it_should_be_published_if_the_channel_is__ATTACHED" fails on the CI under macOS 13 [Beta] for several reasons:

in case of ttl <= 5 (seconds) it fails auth process with the error "Error 40142 - Token expired. (See https://help.ably.io/error/40142 for help.)". Locally it doesn't fail. If to increase ttl, the realtime never sends DISCONNECTED message, and this test ends up with a series of AUTH, and fails with timeout not receiving DISCONNECTED message.

What I've noticed, is that all ttl values less than 30 seconds realtime considers as 0 and expires token immediately, whereas values greater than 30, it only takes the part above 30 (so it subtracts 30 form ttl value), and expires token in the remainder value of seconds (35 - 30 = 5 seconds of token ttl).

According to RTN22a "Ably reserves the right to forcibly disconnect a client that does not re-authenticate within an acceptable period of time, or at any time the token is deemed no longer valid. A client is forcibly disconnected following a DISCONNECTED message containing an error code in the range 40140 <= code < 40150. This will in effect force the client to re-authenticate and resume the connection immediately."

So, the realtime not sending a DISCONNECTED message is an expected behaviour and the fact that this test works under macOS 12 on CI and locally under macOS 13 is rather by accident or a realtime bug.

Besides all of this, the test itself doesn't do what it title says and makes assertions in contradiction to it, f.e. the title says "should NOT be queued", but tests expects client.internal.queuedMessages.count to be 1.

So I temporarily have made this test to be similar to "test__080...". The only difference is expecting ATTACHED in oppose to ATTACHING in the "test__080...".

┆Issue is synchronized with this Jira Task by Unito

maratal avatar Sep 10 '23 19:09 maratal

➤ Automation for Jira commented:

The link to the corresponding Jira issue is https://ably.atlassian.net/browse/SDK-3846

sync-by-unito[bot] avatar Sep 10 '23 19:09 sync-by-unito[bot]