[chore]Fix time skew in TestLRUSetLifeTime using epsilon assertion#43146
Merged
Conversation
carsonip
approved these changes
Oct 6, 2025
mx-psi
approved these changes
Oct 6, 2025
Member
mx-psi
left a comment
There was a problem hiding this comment.
Thanks! LGTM, I added a couple more issues to the "Fixes" list
graphaelli
pushed a commit
to graphaelli/opentelemetry-collector-contrib
that referenced
this pull request
Oct 6, 2025
…pen-telemetry#43146) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description `TestLRUSetLifeTime` is a flaky test that we have taken a couple of stabs to fix in the past however we haven't been successful. I have tried reproducing the error in my local but failed. Looking into the code for go-freelru I discovered that the library uses wall clock (and not monotonic clock) for expiring items which might be the root cause of the flakiness (elastic/go-freelru#1). In an attempt to fix this, I have migrated to `assert.InEpsilon` and tightened the bounds for `AssertEventually` to about 1% delta. <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes open-telemetry#42538 (edit: added by @mx-psi) Fixes open-telemetry#42670 Fixes open-telemetry#42413 <!--Describe what testing was performed and which tests were added.--> #### Testing N/A <!--Describe the documentation added.--> #### Documentation N/A <!--Please delete paragraphs that you did not use before submitting.-->
mashhurs
pushed a commit
to mashhurs/opentelemetry-collector-contrib
that referenced
this pull request
Oct 9, 2025
…pen-telemetry#43146) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description `TestLRUSetLifeTime` is a flaky test that we have taken a couple of stabs to fix in the past however we haven't been successful. I have tried reproducing the error in my local but failed. Looking into the code for go-freelru I discovered that the library uses wall clock (and not monotonic clock) for expiring items which might be the root cause of the flakiness (elastic/go-freelru#1). In an attempt to fix this, I have migrated to `assert.InEpsilon` and tightened the bounds for `AssertEventually` to about 1% delta. <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes open-telemetry#42538 (edit: added by @mx-psi) Fixes open-telemetry#42670 Fixes open-telemetry#42413 <!--Describe what testing was performed and which tests were added.--> #### Testing N/A <!--Describe the documentation added.--> #### Documentation N/A <!--Please delete paragraphs that you did not use before submitting.-->
tommyers-elastic
pushed a commit
to tommyers-elastic/opentelemetry-collector-contrib
that referenced
this pull request
Oct 10, 2025
…pen-telemetry#43146) <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description `TestLRUSetLifeTime` is a flaky test that we have taken a couple of stabs to fix in the past however we haven't been successful. I have tried reproducing the error in my local but failed. Looking into the code for go-freelru I discovered that the library uses wall clock (and not monotonic clock) for expiring items which might be the root cause of the flakiness (elastic/go-freelru#1). In an attempt to fix this, I have migrated to `assert.InEpsilon` and tightened the bounds for `AssertEventually` to about 1% delta. <!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes open-telemetry#42538 (edit: added by @mx-psi) Fixes open-telemetry#42670 Fixes open-telemetry#42413 <!--Describe what testing was performed and which tests were added.--> #### Testing N/A <!--Describe the documentation added.--> #### Documentation N/A <!--Please delete paragraphs that you did not use before submitting.-->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
TestLRUSetLifeTimeis a flaky test that we have taken a couple of stabs to fix in the past however we haven't been successful. I have tried reproducing the error in my local but failed. Looking into the code for go-freelru I discovered that the library uses wall clock (and not monotonic clock) for expiring items which might be the root cause of the flakiness (elastic/go-freelru#1). In an attempt to fix this, I have migrated toassert.InEpsilonand tightened the bounds forAssertEventuallyto about 1% delta.Link to tracking issue
Fixes #42538
(edit: added by @mx-psi)
Fixes #42670
Fixes #42413
Testing
N/A
Documentation
N/A