Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.17](backport #7058) [flakiness]: utilise socket helper funcs in unit-tests #7167

Open
wants to merge 1 commit into
base: 8.17
Choose a base branch
from

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Mar 4, 2025

What does this PR do?

This PR fixes a failing test case, TestConnInfoConnCloseThenAnotherConn, which was caused by the generation of overly long Unix socket paths. On macOS, UNIX-domain addresses are limited to 104 characters, while Linux imposes a 108-character limit. The previous implementation in getAddress did not validate or handle excessive path lengths, causing the test to fail on macOS and occasionally on Linux.

To resolve this, the PR updates getAddress to utilize the existing SocketURLWithFallback helper function from pkg/utils/socket_unix.go, which ensures that socket paths remain within system limits.

Why is it important?

This change is essential to prevent flakiness in the test suite and ensure that the test runs reliably across different platforms. By leveraging the existing socket utility functions, we ensure that socket paths adhere to OS-imposed constraints, reducing test failures and improving CI stability.

Checklist

  • I have read and understood the pull request guidelines of this project.
  • 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 changes to the default configuration files.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added an entry in ./changelog/fragments using the changelog tool.
  • I have added an integration test or an E2E test.

Disruptive User Impact

This change only affects the test suite and does not impact users.

How to test this PR locally

Run the following test command locally and verify that it no longer fails due to socket path length issues:

mage test:unit

Related issues


This is an automatic backport of pull request #7058 done by [Mergify](https://mergify.com).

@mergify mergify bot requested a review from a team as a code owner March 4, 2025 10:37
@mergify mergify bot added the backport label Mar 4, 2025
@mergify mergify bot requested review from kaanyalti and andrzej-stencel and removed request for a team March 4, 2025 10:37
@pierrehilbert pierrehilbert added the Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team label Mar 4, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/elastic-agent-control-plane (Team:Elastic-Agent-Control-Plane)

Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants