fix(kms-connector): reduce port collision in tests#1680
Conversation
There was a problem hiding this comment.
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.
e1241fd to
082dae6
Compare
082dae6 to
f5d983a
Compare
🧪 CI InsightsHere's what we observed from your CI run for f5d983a. 🟢 All jobs passed!But CI Insights is watching 👀 |
|
@Mergifyio queue |
✅ The pull request has been merged automaticallyDetailsThe pull request has been merged automatically at 77e5bb7 |
Merge Queue Status✅ The pull request has been merged at f5d983a This pull request spent 39 minutes 8 seconds in the queue, including 43 minutes 42 seconds running CI. Required conditions to merge
|
Closes https://github.com/zama-ai/fhevm-internal/issues/825
I reduce the usage of the
pick_free_portfn 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.