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

flakey test: channel_resume_lost_continuity #945

Open
AndyTWF opened this issue May 17, 2023 · 1 comment
Open

flakey test: channel_resume_lost_continuity #945

AndyTWF opened this issue May 17, 2023 · 1 comment
Labels
failing-test Where an automated test is failing either locally or in CI. Perhaps flakey, wrong or bug. testing Includes all kinds of automated tests, the way that we run them and the infrastructure around them.

Comments

@AndyTWF
Copy link
Contributor

AndyTWF commented May 17, 2023

io.ably.lib.test.realtime.RealtimeSuite > io.ably.lib.test.realtime.RealtimeChannelTest.channel_resume_lost_continuity[text_protocol] FAILED
    java.lang.AssertionError: Verify channel was attached expected:<false> but was:<true>
        at org.junit.Assert.fail(Assert.java:88)
        at org.junit.Assert.failNotEquals(Assert.java:834)
        at org.junit.Assert.assertEquals(Assert.java:118)
        at io.ably.lib.test.realtime.RealtimeChannelTest.channel_resume_lost_continuity(RealtimeChannelTest.java:1629)

┆Issue is synchronized with this Jira Task by Unito

@AndyTWF AndyTWF added testing Includes all kinds of automated tests, the way that we run them and the infrastructure around them. failing-test Where an automated test is failing either locally or in CI. Perhaps flakey, wrong or bug. labels May 17, 2023
@sync-by-unito
Copy link

sync-by-unito bot commented May 17, 2023

➤ Automation for Jira commented:

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

AndyTWF added a commit that referenced this issue May 24, 2023
This test was failing because of the order in which listeners were registered. The channel waiters
were created (and thus registered as listeners) before the listeners that add state changes to the
arrays ready for assertions. EventEmitter runs listeners that don't have a filter in order of registration.

This meant that sometimes, the test would run, the waiter would be informed of a channel state change, thus allowing
it to proceed into the assertions phase on the main thread, and only then would the subjects of those assertions be updated.

So you can end up in a situation where the main thread would start asserting on things before all the listeners had run.

This change fixes the issue by ensuring the waiters are registered after the main listeners, so that the assertions will
always run once all the states that are going to be received, are received.

You can test this behaviour by adding a sleep just before the line where attachingStateReached[0] is set to true. If you remove
the change in this commit, the test will fail.

Fixes #945
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
failing-test Where an automated test is failing either locally or in CI. Perhaps flakey, wrong or bug. testing Includes all kinds of automated tests, the way that we run them and the infrastructure around them.
Development

Successfully merging a pull request may close this issue.

1 participant