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

fix: flaky test #92

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

Conversation

miparnisari
Copy link
Contributor

@miparnisari miparnisari commented Nov 27, 2023

Issue #1: the linter is reporting an error

[27/11/23 10:15:28] ~/GitHub/ccache (master) $ make l
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest && golangci-lint run
cache_test.go:411:14: SA4008: variable in loop condition never changes (staticcheck)
        for i := 0; i < 1000000; i++ {
                    ^
make: *** [l] Error 1

Issue #2: the test is flaky

-test.run ^\QTest_ConcurrentClearAndSet\E$
=== RUN   Test_ConcurrentClearAndSet
    cache_test.go:456: cache list and lookup are not consistent in iteration 11840
--- FAIL: Test_ConcurrentClearAndSet (7.11s)

}
time.Sleep(time.Millisecond)
return expectedCount == actualCount
}, 100, 50*time.Millisecond, fmt.Sprintf("cache list and lookup are not consistent in iteration %v", i))
Copy link
Contributor Author

@miparnisari miparnisari Nov 27, 2023

Choose a reason for hiding this comment

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

It doesn't matter what numbers I pass here, i always get a failure. @karlseguin are you sure this test is correct? I'm not familiar with the internals very well to understand what you are trying to test.

@@ -413,14 +414,15 @@ func Test_ConcurrentClearAndSet(t *testing.T) {
var wg sync.WaitGroup

cache := New(Configure[string]())
wg.Add(1)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@miparnisari miparnisari marked this pull request as ready for review November 28, 2023 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant