Skip to content

Conversation

@orestisfl
Copy link
Contributor

@orestisfl orestisfl commented Dec 8, 2025

Proposed commit message

Changes:

  • Refactor TestMultipleReceivers to easily scale to n>2 receivers
  • Clean up *.sock files
  • Add multiReceiverHelper struct to encapsulate receiver test setup
  • Add helper functions: hostFromSocket, writeFile
  • Use UUID for socket path generation instead of random bytes
  • Use DialContext instead of Dial to fix noctx lint warning

Pulled out from #47870 for easier review.

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.

How to test this PR locally

Run the test

Related issues

Changes:
- Refactor TestMultipleReceivers to easily scale to n>2 receivers
- Use t.TempDir() to clean-up *.sock files
- Add multiReceiverHelper struct to encapsulate receiver test setup
- Add helper functions: hostFromSocket, writeFile
- Use UUID for socket path generation instead of random bytes
- Use DialContext instead of Dial to fix noctx lint warning

Pulled out from elastic#47870 for easier review.
@orestisfl orestisfl self-assigned this Dec 8, 2025
@orestisfl orestisfl added cleanup Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team labels Dec 8, 2025
@orestisfl orestisfl requested a review from a team as a code owner December 8, 2025 12:16
@orestisfl orestisfl added backport-8.19 Automated backport to the 8.19 branch skip-changelog backport-9.2 Automated backport to the 9.2 branch labels Dec 8, 2025
@elasticmachine
Copy link
Contributor

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

@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Dec 8, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 2025

🤖 GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@orestisfl orestisfl requested a review from leehinman December 8, 2025 12:17
Copy link
Contributor

@leehinman leehinman left a comment

Choose a reason for hiding this comment

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

question on the length of the socket names, otherwise LGTM.

@orestisfl orestisfl enabled auto-merge (squash) December 9, 2025 07:27
@orestisfl orestisfl requested a review from leehinman December 9, 2025 07:27
@orestisfl orestisfl merged commit 135d04f into elastic:main Dec 9, 2025
23 checks passed
mergify bot pushed a commit that referenced this pull request Dec 9, 2025
## Proposed commit message
Changes:
- Refactor TestMultipleReceivers to easily scale to n>2 receivers
- Clean up *.sock files
- Add multiReceiverHelper struct to encapsulate receiver test setup
- Add helper functions: hostFromSocket, writeFile
- Use UUID for socket path generation instead of random bytes
- Use DialContext instead of Dial to fix noctx lint warning

Pulled out from #47870 for easier review.

(cherry picked from commit 135d04f)

# Conflicts:
#	x-pack/filebeat/fbreceiver/receiver_test.go
mergify bot pushed a commit that referenced this pull request Dec 9, 2025
## Proposed commit message
Changes:
- Refactor TestMultipleReceivers to easily scale to n>2 receivers
- Clean up *.sock files
- Add multiReceiverHelper struct to encapsulate receiver test setup
- Add helper functions: hostFromSocket, writeFile
- Use UUID for socket path generation instead of random bytes
- Use DialContext instead of Dial to fix noctx lint warning

Pulled out from #47870 for easier review.

(cherry picked from commit 135d04f)

# Conflicts:
#	x-pack/filebeat/fbreceiver/receiver_test.go
orestisfl added a commit that referenced this pull request Dec 9, 2025
## Proposed commit message
Changes:
- Refactor TestMultipleReceivers to easily scale to n>2 receivers
- Clean up *.sock files
- Add multiReceiverHelper struct to encapsulate receiver test setup
- Add helper functions: hostFromSocket, writeFile
- Use UUID for socket path generation instead of random bytes
- Use DialContext instead of Dial to fix noctx lint warning

Pulled out from #47870 for easier review.

(cherry picked from commit 135d04f)

# Conflicts:
#	x-pack/filebeat/fbreceiver/receiver_test.go
orestisfl added a commit to orestisfl/beats that referenced this pull request Dec 9, 2025
Changes:
- Refactor TestMultipleReceivers to easily scale to n>2 receivers
- Clean up *.sock files
- Add multiReceiverHelper struct to encapsulate receiver test setup
- Add helper functions: hostFromSocket, writeFile
- Use UUID for socket path generation instead of random bytes
- Use DialContext instead of Dial to fix noctx lint warning

Pulled out from elastic#47870 for easier review.
orestisfl added a commit that referenced this pull request Dec 9, 2025
)

## Proposed commit message
Changes:
- Refactor TestMultipleReceivers to easily scale to n>2 receivers
- Clean up *.sock files
- Add multiReceiverHelper struct to encapsulate receiver test setup
- Add helper functions: hostFromSocket, writeFile
- Use UUID for socket path generation instead of random bytes
- Use DialContext instead of Dial to fix noctx lint warning

Pulled out from #47870 for easier review.

(cherry picked from commit 135d04f)

# Conflicts:
#	x-pack/filebeat/fbreceiver/receiver_test.go

Co-authored-by: Orestis Floros <[email protected]>
@orestisfl orestisfl deleted the refactor-receiver-tests branch December 10, 2025 13:21
orestisfl added a commit to orestisfl/beats that referenced this pull request Dec 10, 2025
On Windows, open file handles prevent t.TempDir() cleanup.
Add defer f.Close() to properly release the file handle.

Fixes test failure introduced in elastic#47969.
orestisfl added a commit that referenced this pull request Dec 10, 2025
On Windows, open file handles prevent t.TempDir() cleanup.
Add defer f.Close() to properly release the file handle.

Fixes test failure introduced in #47969.
mergify bot pushed a commit that referenced this pull request Dec 10, 2025
On Windows, open file handles prevent t.TempDir() cleanup.
Add defer f.Close() to properly release the file handle.

Fixes test failure introduced in #47969.

(cherry picked from commit 061db97)

# Conflicts:
#	x-pack/filebeat/fbreceiver/receiver_test.go
mergify bot pushed a commit that referenced this pull request Dec 10, 2025
On Windows, open file handles prevent t.TempDir() cleanup.
Add defer f.Close() to properly release the file handle.

Fixes test failure introduced in #47969.

(cherry picked from commit 061db97)
orestisfl added a commit that referenced this pull request Dec 10, 2025
On Windows, open file handles prevent t.TempDir() cleanup.
Add defer f.Close() to properly release the file handle.

Fixes test failure introduced in #47969.
orestisfl added a commit that referenced this pull request Dec 10, 2025
)

On Windows, open file handles prevent t.TempDir() cleanup.
Add defer f.Close() to properly release the file handle.

Fixes test failure introduced in #47969.

(cherry picked from commit 061db97)

Co-authored-by: Orestis Floros <[email protected]>
orestisfl added a commit that referenced this pull request Dec 10, 2025
…ainability (#47994)

* fbreceiver: refactor receiver tests for maintainability (#47969)

## Proposed commit message
Changes:
- Refactor TestMultipleReceivers to easily scale to n>2 receivers
- Clean up *.sock files
- Add multiReceiverHelper struct to encapsulate receiver test setup
- Add helper functions: hostFromSocket, writeFile
- Use UUID for socket path generation instead of random bytes
- Use DialContext instead of Dial to fix noctx lint warning

Pulled out from #47870 for easier review.

(cherry picked from commit 135d04f)

# Conflicts:
#	x-pack/filebeat/fbreceiver/receiver_test.go

* Fix conflicts

* fbreceiver: close file in writeFile to fix Windows test (#48019)

On Windows, open file handles prevent t.TempDir() cleanup.
Add defer f.Close() to properly release the file handle.

Fixes test failure introduced in #47969.

---------

Co-authored-by: Orestis Floros <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-8.19 Automated backport to the 8.19 branch backport-9.2 Automated backport to the 9.2 branch cleanup 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.

3 participants