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

fix: fix flaky port number assignments in cucumber #4305

Conversation

hansieodendaal
Copy link
Contributor

@hansieodendaal hansieodendaal commented Jul 13, 2022

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 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

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.
@hansieodendaal hansieodendaal changed the title fix: fix flaky port cucumber numbers fix: fix flaky port number assignments in cucumber Jul 13, 2022
@aviator-app aviator-app bot merged commit e8d4a00 into tari-project:development Jul 13, 2022
@hansieodendaal hansieodendaal deleted the fix_flaky_port_cucumber_numbers branch July 13, 2022 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants