holepunchto / hyperswarm

A distributed networking stack for connecting peers.
https://docs.holepunch.to
MIT License
1.08k stars 87 forks source link

Fix flaky retry-timer test #158

Closed HDegroote closed 1 year ago

HDegroote commented 1 year ago

The 'retry timer - proven peer reinsertion' test is flaky, I think because there's 0 margin built-in. I added an additional check to verify that the retry was triggered once after the first wait, and noticed that it rarely was, so I added some margin.

I'm not 100% sure that the changes I made make sense though, so do review.

This is an example output for a failing run of the old test:


# retry timer - proven peer reinsertion
    not ok 1 - should be equal
      ---
      actual: 1
      expected: 2
      operator: is
      source: |

          t.is(calls, 2)
        ----^

          rt.destroy()
      stack: |
        ./test/retry-timer.js:37:5
        runNextTicks (node:internal/process/task_queues:60:5)
        process.processTimers (node:internal/timers:511:9)
        async Test._run (./node_modules/brittle/index.js:573:7)
` `