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

add test to ensure calling set after close does not panic #298

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

Conversation

joshua-goldstein
Copy link
Contributor

In a prior version of Ristretto, calling set after close could cause a panic. We are adding this test to check for this behavior and prevent a regression. Test was originally written by @josephschorr in this PR.

// Wait some more time so Set can run a few additional times.
tcd := time.Tick(250 * time.Millisecond)
<-tcd
close(done)
Copy link
Contributor

Choose a reason for hiding this comment

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

@joshua-goldstein Is there some state that can be checked to see if the test succeeded? Other than the check of err on the creation of NewCache, there's no other way the test can fail, right? Or perhaps the previous panic is the only error condition.

Choose a reason for hiding this comment

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

The idea behind the test is that if the bug exists, the race detector will raise a panic (thus breaking the test)

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.

None yet

3 participants