Skip to content

test: use a free port in the pubsub integration tests - #1845

Open
javier-aliaga wants to merge 1 commit into
dapr:masterfrom
javier-aliaga:fix/pubsub-it-free-port
Open

javier-aliaga wants to merge 1 commit into
dapr:masterfrom
javier-aliaga:fix/pubsub-it-free-port

Conversation

@javier-aliaga

Copy link
Copy Markdown
Contributor

Description

DaprPubSubIT and DaprPubSubOutboxIT picked a random port between 8000 and 8999 for the Spring Boot app. DaprSpringMessagingIT runs Spring Boot on a fixed 8080 in the same JVM, and its cached Spring context keeps that port open. When DaprPubSubIT drew 8080, all 8 of its tests failed with Port 8080 is already in use.

This happened in dapr/dapr's dapr-test-sdk run: https://github.com/dapr/dapr/actions/runs/38477497349

Both tests now ask the OS for a free port with DaprContainerFactory.allocateFreePort(), which already existed and is now public. DaprPubSubOutboxIT is disabled (#1603) but had the same code, so it is fixed too.

Issue reference

No issue. CI flake.

Checklist

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

Verified locally: DaprSpringMessagingIT and DaprPubSubIT run together in one JVM, 9/9 pass, DaprPubSubIT on an OS-assigned port.

DaprPubSubIT and DaprPubSubOutboxIT picked a random port between 8000
and 8999. DaprSpringMessagingIT runs Spring Boot on 8080 in the same
JVM and its cached context keeps the port open, so DaprPubSubIT fails
with "Port 8080 is already in use" when it draws 8080.

Ask the OS for a free port with the existing
DaprContainerFactory.allocateFreePort() instead.

Signed-off-by: Javier Aliaga <javier@diagrid.io>
Copilot AI balanced review requested due to automatic review settings October 14, 2026 16:52
@javier-aliaga
javier-aliaga requested review from a team as code owners October 14, 2026 16:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codecov

codecov Bot commented Oct 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.69%. Comparing base (ca2a930) to head (0c056af).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1845   +/-   ##
=========================================
  Coverage     79.69%   79.69%           
  Complexity     2687     2687           
=========================================
  Files           267      267           
  Lines          7933     7933           
  Branches        842      842           
=========================================
  Hits           6322     6322           
  Misses         1255     1255           
  Partials        356      356           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

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