Commit 8bcf56f
authored
fix: fix flaky pubsub test (ipfs#3761)
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: +[]
```1 parent 6fd7776 commit 8bcf56f
1 file changed
+26
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
43 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
44 | 56 | | |
45 | 57 | | |
46 | 58 | | |
| |||
50 | 62 | | |
51 | 63 | | |
52 | 64 | | |
53 | | - | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
54 | 77 | | |
55 | 78 | | |
56 | 79 | | |
0 commit comments