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

[flakiness]: utilise socket helper funcs in unit-tests #7058

Conversation

pkoutsovasilis
Copy link
Contributor

@pkoutsovasilis pkoutsovasilis commented Feb 27, 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

@pkoutsovasilis pkoutsovasilis added Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team skip-changelog backport-8.x Automated backport to the 8.x branch with mergify backport-8.17 Automated backport with mergify backport-8.18 Automated backport to the 8.18 branch backport-9.0 Automated backport to the 9.0 branch labels Feb 27, 2025
@pkoutsovasilis pkoutsovasilis self-assigned this Feb 27, 2025
@pkoutsovasilis
Copy link
Contributor Author

buildkite test this

@pkoutsovasilis pkoutsovasilis force-pushed the fix/TestConnInfoConnCloseThenAnotherConn branch from b1bdfb1 to 2c0aa7a Compare February 27, 2025 20:03
@elasticmachine
Copy link
Contributor

elasticmachine commented Feb 27, 2025

💛 Build succeeded, but was flaky

Failed CI Steps

History

cc @pkoutsovasilis

Copy link

@pkoutsovasilis pkoutsovasilis marked this pull request as ready for review February 27, 2025 21:48
@pkoutsovasilis pkoutsovasilis requested a review from a team as a code owner February 27, 2025 21:48
@elasticmachine
Copy link
Contributor

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

@pkoutsovasilis pkoutsovasilis added the flaky-test Unstable or unreliable test cases. label Feb 27, 2025
@pkoutsovasilis pkoutsovasilis added backport-active-all Automated backport with mergify to all the active branches and removed backport-8.x Automated backport to the 8.x branch with mergify backport-8.17 Automated backport with mergify backport-8.18 Automated backport to the 8.18 branch backport-9.0 Automated backport to the 9.0 branch labels Mar 4, 2025
@pkoutsovasilis pkoutsovasilis merged commit d7225b2 into elastic:main Mar 4, 2025
20 checks passed
mergify bot pushed a commit that referenced this pull request Mar 4, 2025
mergify bot pushed a commit that referenced this pull request Mar 4, 2025
mergify bot pushed a commit that referenced this pull request Mar 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-active-all Automated backport with mergify to all the active branches flaky-test Unstable or unreliable test cases. skip-changelog Team:Elastic-Agent-Control-Plane Label for the Agent Control Plane team
Projects
None yet
3 participants