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 eviction callback tests #61

Open
erni27 opened this issue Feb 21, 2024 · 0 comments
Open

Fix flaky eviction callback tests #61

erni27 opened this issue Feb 21, 2024 · 0 comments
Labels
good first issue Good for newcomers tests Improvements to tests

Comments

@erni27
Copy link
Owner

erni27 commented Feb 21, 2024

To test the eviction callback functionality the following mock struct is used https://github.com/erni27/imcache/blob/master/imcache_test.go#L1018.

Since the eviction callbacks are invoked in the separate goroutine(s), the assertion methods should wait reasonable amount of time to make sure that the callback has eventually been called / has not been called (e.g. https://github.com/erni27/imcache/blob/master/imcache_test.go#L1029).

Most of the assertion methods though are flaky, e.g. HasNotBeenCalledWith (https://github.com/erni27/imcache/blob/master/imcache_test.go#L1050) doesn't ensure the callback really has not been called.

Revisit evictionCallbackMock and improve the flaky assertions. Make sure all tests use the proper assertion methods.

@erni27 erni27 added tests Improvements to tests good first issue Good for newcomers labels Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers tests Improvements to tests
Projects
None yet
Development

No branches or pull requests

1 participant