Skip to content

[beatreceiver] Add e2e tests for tcp and udp inputs#51705

Merged
khushijain21 merged 8 commits into
elastic:mainfrom
khushijain21:tcp-udp-test
Jul 6, 2026
Merged

[beatreceiver] Add e2e tests for tcp and udp inputs#51705
khushijain21 merged 8 commits into
elastic:mainfrom
khushijain21:tcp-udp-test

Conversation

@khushijain21

@khushijain21 khushijain21 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Proposed commit message

This PR adds e2e test that compares document ingested by tcp and udp input in standalone and otel mode.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works. Where relevant, I have used the stresstest.sh script to run them under stress conditions and race detector to verify their stability.
  • I have added an entry in ./changelog/fragments using the changelog tool.

Disruptive User Impact

None

How to test this PR locally

cd x-pack/filebeat
go test -run TestTCPInputOTelE2E -tags integration ./tests/integration -v 

Related issues

@botelastic botelastic Bot added the needs_team Indicates that the issue/PR needs a Team:* label label Jul 3, 2026
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

🤖 GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)
  • /test : Run the Buildkite pipeline.

@mergify

mergify Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @khushijain21? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-8./d is the label to automatically backport to the 8./d branch. /d is the digit
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.

@khushijain21 khushijain21 marked this pull request as ready for review July 3, 2026 08:58
@khushijain21 khushijain21 requested a review from a team as a code owner July 3, 2026 08:58
@khushijain21 khushijain21 added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Jul 3, 2026
@botelastic botelastic Bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jul 3, 2026
@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

@khushijain21 khushijain21 added needs_team Indicates that the issue/PR needs a Team:* label skip-changelog labels Jul 3, 2026
@botelastic botelastic Bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jul 3, 2026
@khushijain21 khushijain21 added needs_team Indicates that the issue/PR needs a Team:* label backport-skip Skip notification from the automated backport with mergify labels Jul 3, 2026
@botelastic botelastic Bot removed the needs_team Indicates that the issue/PR needs a Team:* label label Jul 3, 2026
@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds a new integration test file for Filebeat, otel_tcp_udp_test.go, containing two exported tests (TestTCPInputOTelE2E, TestUDPInputOTelE2E) that verify end-to-end behavior when Filebeat's TCP/UDP net inputs are routed through Elastic's OTEL pipeline. The tests generate OTEL and Filebeat configs from templates, start both the OTEL collector and Filebeat, send identical test messages via both paths, query Elasticsearch data streams for both, and assert the resulting documents match aside from a fixed set of ignored fields.

Changes

Area Change
Integration tests New file adding two E2E tests covering TCP and UDP input routing through OTEL, with shared setup/run helper, config generation, client execution, and Elasticsearch document comparison logic.

Suggested labels: enhancement

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • 🛠️ Update Documentation

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.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 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.

Inline comments:
In `@x-pack/filebeat/tests/integration/otel_tcp_udp_test.go`:
- Around line 217-226: The UDP readiness check in the otel_tcp_udp test is a
no-op because net.Dial on UDP does not confirm the receiver is bound, so update
the readiness logic in TestUDPInputOTelE2E to wait for a log message that proves
the UDP listener started. Replace the current require.EventuallyWithTf probe
around the net.Dial call with a log-based wait such as WaitLogsContainsAnyOrder,
using the existing otelAddress/inputType context to target the OTel UDP input
startup signal before launching runClient.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 0db0cd8c-ff02-46e0-9f7c-f9eaaab23a0e

📥 Commits

Reviewing files that changed from the base of the PR and between 2145bda and 0f84f7b.

⛔ Files ignored due to path filters (1)
  • x-pack/filebeat/test.log is excluded by !**/*.log
📒 Files selected for processing (1)
  • x-pack/filebeat/tests/integration/otel_tcp_udp_test.go

Comment thread x-pack/filebeat/tests/integration/otel_tcp_udp_test.go Outdated
@khushijain21 khushijain21 requested a review from orestisfl July 3, 2026 10:55
Comment thread x-pack/filebeat/test.log Outdated
Comment thread x-pack/filebeat/tests/integration/otel_tcp_udp_test.go Outdated
@orestisfl orestisfl self-requested a review July 3, 2026 11:57
Comment thread x-pack/filebeat/tests/integration/otel_tcp_udp_test.go Outdated

@orestisfl orestisfl 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.

Thanks!

@khushijain21 khushijain21 enabled auto-merge (squash) July 6, 2026 07:06
@khushijain21 khushijain21 merged commit 133ab6a into elastic:main Jul 6, 2026
30 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-skip Skip notification from the automated backport with mergify skip-changelog Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants