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

Avoid ephemeral ports in integration tests #1244

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions it/distribution_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,31 @@

@it.random_rally_config
def test_tar_distributions(cfg):
port = 19200
for dist in it.DISTRIBUTIONS:
for track in it.TRACKS:
it.wait_until_port_is_free()
it.wait_until_port_is_free(port_number=port)
assert it.race(cfg, f"--distribution-version=\"{dist}\" --track=\"{track}\" "
f"--test-mode --car=4gheap") == 0
f"--test-mode --car=4gheap --target-hosts=127.0.0.1:{port}") == 0


@it.random_rally_config
def test_docker_distribution(cfg):
port = 19200
# only test the most recent Docker distribution
dist = it.DISTRIBUTIONS[-1]
it.wait_until_port_is_free(port_number=19200)
it.wait_until_port_is_free(port_number=port)
assert it.race(cfg, f"--pipeline=\"docker\" --distribution-version=\"{dist}\" "
f"--track=\"geonames\" --challenge=\"append-no-conflicts-index-only\" --test-mode "
f"--car=4gheap --target-hosts=127.0.0.1:19200") == 0
f"--car=4gheap --target-hosts=127.0.0.1:{port}") == 0


@pytest.fixture(scope="module")
def test_cluster():
cluster = it.TestCluster("in-memory-it")
# test with a recent distribution as eventdata is not available for all versions
dist = it.DISTRIBUTIONS[-1]
port = 49200
port = 19200
race_id = str(uuid.uuid4())

it.wait_until_port_is_free(port_number=port)
Expand Down
13 changes: 7 additions & 6 deletions it/sources_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@

@it.random_rally_config
def test_sources(cfg):
it.wait_until_port_is_free()
assert it.race(cfg, "--revision=latest --track=geonames --test-mode "
"--challenge=append-no-conflicts --car=4gheap --elasticsearch-plugins=analysis-icu") == 0
port = 19200
it.wait_until_port_is_free(port_number=port)
assert it.race(cfg, f"--revision=latest --track=geonames --test-mode --target-hosts=127.0.0.1:{port} "
f"--challenge=append-no-conflicts --car=4gheap --elasticsearch-plugins=analysis-icu") == 0

it.wait_until_port_is_free()
assert it.race(cfg, "--pipeline=from-sources --track=geonames --test-mode "
"--challenge=append-no-conflicts-index-only --car=\"4gheap,ea\"") == 0
it.wait_until_port_is_free(port_number=port)
assert it.race(cfg, f"--pipeline=from-sources --track=geonames --test-mode --target-hosts=127.0.0.1:{port} "
f"--challenge=append-no-conflicts-index-only --car=\"4gheap,ea\"") == 0
2 changes: 1 addition & 1 deletion it/tracker_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_cluster():
cluster = it.TestCluster("in-memory-it")
# test with a recent distribution
dist = it.DISTRIBUTIONS[-1]
port = 49200
port = 19200
race_id = str(uuid.uuid4())

it.wait_until_port_is_free(port_number=port)
Expand Down