Skip to content

[bug] Fix datalayer Collector test flake #1342

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

elevran
Copy link
Contributor

@elevran elevran commented Aug 9, 2025

This fixes a test race condition when the start of the collector goroutine is delayed (e.g., on a loaded system).

In the original code, ticks are sent immediately upon return from Start. Unfortunately, there is a race condition due to timing: the collector's goroutine might not have reached the select statement when the ticks are sent.
The test timing is unpredictable:

  • if the collector goroutine starts fast enough to catch both ticks before Stop is called, the test passes.
  • otherwise, if The collector goroutine starts too slowly, it misses one or both ticks and the test fails.

The fix is in both the test and collector code:

  • collector code is synchronized to return only after the goroutine has started (it waits on channel created inside Do())
  • test uses require.Eventually (with a much shorter timeout compared to before)

/cc @ahg-g

elevran added 2 commits August 9, 2025 18:36
Signed-off-by: Etai Lev Ran <[email protected]>
@k8s-ci-robot k8s-ci-robot requested a review from ahg-g August 9, 2025 15:48
Copy link

netlify bot commented Aug 9, 2025

Deploy Preview for gateway-api-inference-extension ready!

Name Link
🔨 Latest commit 34ba761
🔍 Latest deploy log https://app.netlify.com/projects/gateway-api-inference-extension/deploys/6899c249fee6aa00081aeeed
😎 Deploy Preview https://deploy-preview-1342--gateway-api-inference-extension.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 9, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: elevran
Once this PR has been reviewed and has the lgtm label, please assign danehans for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Aug 9, 2025
Signed-off-by: Etai Lev Ran <[email protected]>
@elevran
Copy link
Contributor Author

elevran commented Aug 9, 2025

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 9, 2025
elevran added 2 commits August 9, 2025 20:21
Signed-off-by: Etai Lev Ran <[email protected]>
@elevran
Copy link
Contributor Author

elevran commented Aug 9, 2025

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 9, 2025
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants