Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix flaky port number assignments in cucumber (#4305)
Description --- Fixed flaky port cucumber number assignments whereby under certain conditions the same port number were re-used resulting in test failures. This fix serializes ports returned by `const getFreePort = function ()` with a much higher probability for the ports to be unique. In the event that base node creation still fails (e.g. due to port conflicts), the error is catched and the process is retried. A recent example of this in [`run-integration-tests`](https://app.circleci.com/pipelines/github/tari-project/tari/16711/workflows/8aedce83-a2fb-4bbc-b0f4-ff85ff76a627/jobs/42246/parallel-runs/0/steps/0-111) for test `Testing scenario: "When a new node joins the network, it receives all peers"` is shown below where port `45657` was re-used resulting in test failure: ``` Port: 45343 GRPC: 45657 Starting node Basenode45343-seed-SeedNode6... ... Port: 45657 GRPC: 39549 Starting node Basenode45657-seed-SeedNode0... ... stderr: 15:26 WARN PeerListener was unable to start because 'Failed to listen on /ip4/127.0.0.1/tcp/45657: Address already in use (os error 98)' 15:26 ERROR Failed to start listener(s). Failed to listen on /ip4/127.0.0.1/tcp/45657: Address already in use (os error 98). Connection manager is quitting. ``` Motivation and Context --- Some cucumber tests were flaky due to duplicate port assignments. How Has This Been Tested? --- Cucumber tests
- Loading branch information
1 parent
e1704f4
commit e8d4a00
Showing
2 changed files
with
113 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters