Skip to content

Conversation

@eudelins-zama
Copy link
Contributor

@eudelins-zama eudelins-zama commented Dec 30, 2025

Closes https://github.com/zama-ai/fhevm-internal/issues/825

I reduce the usage of the pick_free_port fn as much as possible, because I suspect it to be responsible for port collisions in integration tests due to race conditions (see our slack discussion for more details).

I still use this fn for healthcheck tests, because it is more convenient this way, and these tests are run "alone", so I think the race condition is less likely to happen.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes port collision issues in tests by switching from manually picking free ports to using testcontainers' dynamic port allocation. This ensures that containers can safely run in parallel without port conflicts.

  • Removed pick_free_port() usage in favor of testcontainers' dynamic port allocation
  • Updated test synchronization to wait for earlier log messages
  • Simplified anvil container setup by removing manual port mapping

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
kms-connector/crates/utils/src/tests/setup/gw.rs Removed manual port allocation for anvil container, now using dynamic port assignment via get_host_port_ipv4()
kms-connector/crates/utils/src/tests/setup/db.rs Removed manual port allocation for Postgres container, now using dynamic port assignment via get_host_port_ipv4()
kms-connector/crates/gw-listener/tests/common/mod.rs Updated test to wait for "Subscribed to " log message instead of "Waiting for next" for earlier synchronization

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@eudelins-zama eudelins-zama force-pushed the eudelins/fix/825/reduce-port-collision branch from e1241fd to 082dae6 Compare December 30, 2025 10:09
@eudelins-zama eudelins-zama changed the title fix(kms-connector):reduce port collision in tests fix(kms-connector): reduce port collision in tests Dec 30, 2025
@eudelins-zama eudelins-zama force-pushed the eudelins/fix/825/reduce-port-collision branch from 082dae6 to f5d983a Compare December 30, 2025 10:14
@eudelins-zama eudelins-zama marked this pull request as ready for review December 30, 2025 10:27
@eudelins-zama eudelins-zama requested review from a team and dartdart26 as code owners December 30, 2025 10:27
@mergify
Copy link

mergify bot commented Dec 30, 2025

🧪 CI Insights

Here's what we observed from your CI run for f5d983a.

🟢 All jobs passed!

But CI Insights is watching 👀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants