Skip to content

tests: prevent port binding failures in concurrent OTEL tests#11808

Merged
edsiper merged 1 commit into
masterfrom
prevent_concurrent_test_failures_flb-rt-in_opentelemtry
May 16, 2026
Merged

tests: prevent port binding failures in concurrent OTEL tests#11808
edsiper merged 1 commit into
masterfrom
prevent_concurrent_test_failures_flb-rt-in_opentelemtry

Conversation

@patrick-stephens
Copy link
Copy Markdown
Contributor

@patrick-stephens patrick-stephens commented May 15, 2026

When tests are run concurrently, the flb-rt-in_opentelemetry and flb-rt-in_opentelemetry_routing tests both try to bind to the same port so tweaked the test configuration to use different ports.

Discovered during downstream testing where we happen to run both tests at the same time which does not seem to happen here (but purely by chance): https://github.com/telemetryforge/agent/actions/runs/25921061604/job/76189906835?pr=277

...
        Start  10: flb-rt-in_opentelemetry
...
        Start  22: flb-rt-in_opentelemetry_routing
...
 10/164 Test  #22: flb-rt-in_opentelemetry_routing ............***Failed    5.08 sec
Test otlp_comprehensive_routing...              [2026/05/15 13:52:48.605050512] [ info] [telemetryforge agent] version=26.5.3, commit=23b4105f28, pid=19253
[2026/05/15 13:52:48.605236641] [ info] [storage] ver=1.5.4, type=memory, sync=normal, checksum=off, max_chunks_up=128
[2026/05/15 13:52:48.605244125] [ info] [simd    ] SSE2
[2026/05/15 13:52:48.605247000] [ info] [cmetrics] version=1.0.6
[2026/05/15 13:52:48.605251699] [ info] [ctraces ] version=0.6.6
[2026/05/15 13:52:48.605419293] [ info] [input:opentelemetry:opentelemetry.0] initializing
[2026/05/15 13:52:48.605429192] [ info] [input:opentelemetry:opentelemetry.0] storage_strategy='memory' (memory only)
Error: 5/15 13:52:48.606036158] [error] Error binding socket
[2026/05/15 13:52:48.606045656] [ warn] Cannot listen on 0.0.0.0 port 4318
Error: 5/15 13:52:48.606060865] [error] [downstream] could not bind address 0.0.0.0:4318. Aborting
Error: 5/15 13:52:48.606063870] [error] [input:opentelemetry:opentelemetry.0] could not start http server on 0.0.0.0:4318. Aborting
...
 20/164 Test  #10: flb-rt-in_opentelemetry ....................   Passed   21.31 sec
...

Enter [N/A] in the box, if an item is not applicable to your change.

Testing
Before we can approve your change; please submit the following in a comment:

  • Example configuration file for the change
  • Debug log output from testing the change
  • Attached Valgrind output that shows no leaks or memory corruption was found

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

  • Run local packaging test showing all targets (including any new ones) build.
  • Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • Documentation required for this feature

Backporting

  • Backport to latest stable release.

Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

Signed-off-by: Patrick Stephens <pat@telemetryforge.io>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

📝 Walkthrough

Walkthrough

Port number for the OpenTelemetry test input is updated from 4318 to 4319 in both the C test macro constant and the corresponding YAML test configuration, with added comments documenting the synchronization requirement between files.

Changes

OpenTelemetry test port update

Layer / File(s) Summary
OpenTelemetry port update in test files
tests/runtime/in_opentelemetry_routing.c, tests/runtime/data/routing/otlp_comprehensive_routing_test.yaml
PORT_OTEL macro and YAML pipeline input port both changed from 4318 to 4319, with added comment documenting the YAML file dependency.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • fluent/fluent-bit#11513: Both PRs modify the OpenTelemetry test port hardcoded to 4318—this PR updates to 4319, while the related PR replaces hardcoded values with dynamically provided free ports to prevent collisions.

Suggested reviewers

  • edsiper

Poem

🐰 A port that's worn—now changed from old—
4319 is our new gold!
Test configs dance in sync, so neat,
Where rabbit and telemetry meet! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: preventing port binding failures in concurrent OTEL tests by updating port numbers from 4318 to 4319 in routing test configuration and constants.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch prevent_concurrent_test_failures_flb-rt-in_opentelemtry

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
tests/runtime/in_opentelemetry_routing.c (1)

41-43: ⚡ Quick win

Remove the unused PORT_OTEL macro or use it programmatically to sync with the YAML configuration.

The PORT_OTEL macro is defined here but not used anywhere in this test file. The actual port binding comes from the YAML configuration (referenced at line 246), making this macro a documentation artifact. The comments acknowledge the need to keep it in sync with data/routing/otlp_comprehensive_routing_test.yaml, but this manual synchronization is error-prone.

Either remove the unused macro entirely or refactor to read the port from YAML programmatically to eliminate the synchronization burden.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/runtime/in_opentelemetry_routing.c` around lines 41 - 43, The PORT_OTEL
macro is defined but unused; either remove the macro and its sync comment
entirely or replace it with a runtime value read from the YAML so the test can't
drift from data/routing/otlp_comprehensive_routing_test.yaml. If removing:
delete the PORT_OTEL `#define` and the "pick a port" comment and ensure no
references remain. If keeping: add code in the test setup to parse
data/routing/otlp_comprehensive_routing_test.yaml (the YAML referenced at line
~246) to extract the OTLP port and assign it to a local variable (use that
variable where the test binds/validates the port instead of the macro
PORT_OTEL). Ensure all occurrences of PORT_OTEL in this test are replaced by the
runtime variable.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@tests/runtime/in_opentelemetry_routing.c`:
- Around line 41-43: The PORT_OTEL macro is defined but unused; either remove
the macro and its sync comment entirely or replace it with a runtime value read
from the YAML so the test can't drift from
data/routing/otlp_comprehensive_routing_test.yaml. If removing: delete the
PORT_OTEL `#define` and the "pick a port" comment and ensure no references remain.
If keeping: add code in the test setup to parse
data/routing/otlp_comprehensive_routing_test.yaml (the YAML referenced at line
~246) to extract the OTLP port and assign it to a local variable (use that
variable where the test binds/validates the port instead of the macro
PORT_OTEL). Ensure all occurrences of PORT_OTEL in this test are replaced by the
runtime variable.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1f2e7d37-5214-4cfe-a526-4375099ab2e7

📥 Commits

Reviewing files that changed from the base of the PR and between 8627815 and f393d8c.

📒 Files selected for processing (2)
  • tests/runtime/data/routing/otlp_comprehensive_routing_test.yaml
  • tests/runtime/in_opentelemetry_routing.c

@patrick-stephens
Copy link
Copy Markdown
Contributor Author

Looks like the tail input tests are failing but that is unrelated to these changes and is happening upstream as well: https://github.com/fluent/fluent-bit/actions/runs/25892842380/job/76099561690

@edsiper edsiper merged commit 40a4a4a into master May 16, 2026
43 of 55 checks passed
@edsiper edsiper deleted the prevent_concurrent_test_failures_flb-rt-in_opentelemtry branch May 16, 2026 03:24
@edsiper
Copy link
Copy Markdown
Member

edsiper commented May 16, 2026

thanks!

(yep, taking a look at the rt-tail one)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants