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

Create a helper to find a free TCP port #71

Closed
0x501D opened this issue May 26, 2022 · 1 comment · Fixed by #112
Closed

Create a helper to find a free TCP port #71

0x501D opened this issue May 26, 2022 · 1 comment · Fixed by #112
Assignees
Labels
code health Improve code readability, simplify maintenance and so on

Comments

@0x501D
Copy link
Member

0x501D commented May 26, 2022

In integration tests we have hardcoded ports:
Example

This can cause tests to fail:

    def test_play_test_remote_instance(tt_cmd, tmpdir):
        # Copy the .xlog and instance config files to the "run" directory.
        test_app_path = os.path.join(os.path.dirname(__file__), "test_file")
        shutil.copy(test_app_path + "/test.xlog", tmpdir)
        shutil.copy(test_app_path + "/remote_instance_cfg.lua", tmpdir)
    
        # Play .xlog file to the remote instance.
        cmd = [tt_cmd, "play", "localhost:3301", "test.xlog", "--space=999"]
        instance = subprocess.Popen(["tarantool", "remote_instance_cfg.lua"], cwd=tmpdir)
        # The delay is needed so that the instance has time to start and configure itself
        sleep(1)
        rc, output = run_command_and_get_output(cmd, cwd=tmpdir)
        instance.kill()
>       assert rc == 0
E       assert 1 == 0

test/integration/play/test_play.py:51: AssertionError

It is proposed to create a helper that looks for a free TCP port. This will greatly reduce the chance of falsely failed tests.

@Totktonada
Copy link
Member

We have the long standing issue (races) due to the check-free-port-and-use-it approach in test-run, see tarantool/test-run#141. I suggest to at least try to implement binding to a zero port.

@Totktonada Totktonada added the code health Improve code readability, simplify maintenance and so on label Jun 2, 2022
@LeonidVas LeonidVas added the 1sp label Aug 5, 2022
GRISHNOV added a commit that referenced this issue Aug 9, 2022
Added free port auto resolve mechanism for
integration tests, which require the running
of a tarantool instance.
Also added mechanism for guaranteed instances
termination after integration testing.

Closes #71
GRISHNOV added a commit that referenced this issue Aug 9, 2022
Added free port auto resolve mechanism for
integration tests, which require the running
of a tarantool instance.
Also added mechanism for guaranteed instances
termination after integration testing.

Closes #71
GRISHNOV added a commit that referenced this issue Aug 10, 2022
Added free port auto resolve mechanism for
integration tests, which require the running
of a tarantool instance.
Also added mechanism for guaranteed instances
termination after integration testing.

Closes #71
GRISHNOV added a commit that referenced this issue Sep 15, 2022
Added free port auto resolve mechanism for
integration tests, which require the running
of a tarantool instance.

Closes #71
GRISHNOV added a commit that referenced this issue Sep 15, 2022
Added mechanism for guaranteed instances
termination after integration testing.

Part of #71
GRISHNOV added a commit that referenced this issue Sep 15, 2022
Added free port auto resolve mechanism for
integration tests, which require the running
of a tarantool instance.

Closes #71
GRISHNOV added a commit that referenced this issue Sep 15, 2022
Added mechanism for guaranteed instances
termination after integration testing.

Part of #71
GRISHNOV added a commit that referenced this issue Sep 15, 2022
Added free port auto resolve mechanism for
integration tests, which require the running
of a tarantool instance.

Closes #71
GRISHNOV added a commit that referenced this issue Sep 15, 2022
Added mechanism for guaranteed instances
termination after integration testing.

Part of #71
GRISHNOV added a commit that referenced this issue Oct 5, 2022
Added free port auto resolve mechanism for
integration tests, which require the running
of a tarantool instance.

Closes #71
GRISHNOV added a commit that referenced this issue Oct 5, 2022
Added mechanism for guaranteed instances
termination after integration testing.

Part of #71
GRISHNOV added a commit that referenced this issue Oct 5, 2022
Added mechanism for guaranteed instances
termination after integration testing.

Part of #71
GRISHNOV added a commit that referenced this issue Oct 5, 2022
Added mechanism for guaranteed instances
termination after integration testing.

Part of #71
GRISHNOV added a commit that referenced this issue Oct 5, 2022
Added free port auto resolve mechanism for
integration tests, which require the running
of a tarantool instance.

Closes #71
GRISHNOV added a commit that referenced this issue Oct 5, 2022
Added mechanism for guaranteed instances
termination after integration testing.

Part of #71
GRISHNOV added a commit that referenced this issue Oct 6, 2022
Added free port auto resolve mechanism for
integration tests, which require the running
of a tarantool instance.

Closes #71
GRISHNOV added a commit that referenced this issue Oct 6, 2022
Added mechanism for guaranteed instances
termination after integration testing.

Part of #71
GRISHNOV added a commit that referenced this issue Oct 6, 2022
Added free port auto resolve mechanism for
integration tests, which require the running
of a tarantool instance.

Closes #71
GRISHNOV added a commit that referenced this issue Oct 6, 2022
Added mechanism for guaranteed instances
termination after integration testing.

Part of #71
GRISHNOV added a commit that referenced this issue Oct 7, 2022
Added free port auto resolve mechanism for
integration tests, which require the running
of a tarantool instance.

Closes #71
GRISHNOV added a commit that referenced this issue Oct 7, 2022
Added mechanism for guaranteed instances
termination after integration testing.

Part of #71
GRISHNOV added a commit that referenced this issue Oct 7, 2022
Added mechanism for guaranteed instances
termination after integration testing.

Part of #71
GRISHNOV added a commit that referenced this issue Oct 7, 2022
Added free port auto resolve mechanism for
integration tests, which require the running
of a tarantool instance.

Closes #71
GRISHNOV added a commit that referenced this issue Oct 7, 2022
Added mechanism for guaranteed instances
termination after integration testing.

Part of #71
GRISHNOV added a commit that referenced this issue Oct 10, 2022
Added free port auto resolve mechanism for
integration tests, which require the running
of a tarantool instance.

Closes #71
GRISHNOV added a commit that referenced this issue Oct 10, 2022
Added mechanism for guaranteed instances
termination after integration testing.

Part of #71
GRISHNOV added a commit that referenced this issue Oct 12, 2022
Added free port auto resolve mechanism for
integration tests, which require the running
of a tarantool instance.

Closes #71
GRISHNOV added a commit that referenced this issue Oct 12, 2022
Added mechanism for guaranteed instances
termination after integration testing.

Part of #71
GRISHNOV added a commit that referenced this issue Oct 13, 2022
Added free port auto resolve mechanism for
integration tests, which require the running
of a tarantool instance.

Closes #71
GRISHNOV added a commit that referenced this issue Oct 13, 2022
Added mechanism for guaranteed instances
termination after integration testing.

Part of #71
GRISHNOV added a commit that referenced this issue Oct 13, 2022
Added free port auto resolve mechanism for
integration tests, which require the running
of a tarantool instance.

Closes #71
GRISHNOV added a commit that referenced this issue Oct 13, 2022
Added mechanism for guaranteed instances
termination after integration testing.

Part of #71
GRISHNOV added a commit that referenced this issue Oct 17, 2022
Added free port auto resolve mechanism for
integration tests, which require the running
of a tarantool instance.

Closes #71
GRISHNOV added a commit that referenced this issue Oct 17, 2022
Added mechanism for guaranteed instances
termination after integration testing.

Part of #71
LeonidVas pushed a commit that referenced this issue Oct 18, 2022
Added free port auto resolve mechanism for
integration tests, which require the running
of a tarantool instance.

Closes #71
LeonidVas pushed a commit that referenced this issue Oct 18, 2022
Added mechanism for guaranteed instances
termination after integration testing.

Part of #71
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code health Improve code readability, simplify maintenance and so on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants