Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

fix: fix flaky pubsub test #3761

Merged
merged 1 commit into from
Jul 27, 2021
Merged

fix: fix flaky pubsub test #3761

merged 1 commit into from
Jul 27, 2021

Conversation

achingbrain
Copy link
Member

In the http client, when we subscribe to a topic we open a HTTP connection which we keep open for the duration of the subscription.

When we unsubscribe we abort the connection but it can remain open for a little while after the abort, even if we try to wait on the fetch command ending before continuting, which leads to the topic still being present in the subs list, so retry asserting that the subs list is empty in the tests within a certain time window.

Fixes this sort of error:

ipfs:   1) interface-ipfs-core over ipfs-http-client tests against go-ipfs
ipfs:        .pubsub.unsubscribe
ipfs:          should subscribe 5 handlers and unsubscribe once with no reference to the handlers:
ipfs:       AssertionError: expected [ Array(1) ] to deeply equal []
ipfs:       + expected - actual
ipfs:       -[
ipfs:       -  "pubsub-tests-SVOFzpM5DtbcI7jBETrmm"
ipfs:       -]
ipfs:       +[]

In the http client, when we subscribe to a topic we open a HTTP connection
which we keep open for the duration of the subscription.

When we unsubscribe we abort the connection but it can remain open for a
little while after the abort, even if we try to wait on the `fetch` command
ending before continuting, which leads to the topic still being present in the
subs list, so retry asserting that the subs list is empty in the tests within
a certain time window.

Fixes this sort of error:

```
ipfs:   1) interface-ipfs-core over ipfs-http-client tests against go-ipfs
ipfs:        .pubsub.unsubscribe
ipfs:          should subscribe 5 handlers and unsubscribe once with no reference to the handlers:
ipfs:       AssertionError: expected [ Array(1) ] to deeply equal []
ipfs:       + expected - actual
ipfs:       -[
ipfs:       -  "pubsub-tests-SVOFzpM5DtbcI7jBETrmm"
ipfs:       -]
ipfs:       +[]
```
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant