Open tonyghita opened 3 years ago
Hmm... upon a longer test run I find this test still has issues.
$ go test -race -covermode=atomic -count=30000
--- FAIL: TestLoader (0.00s)
--- FAIL: TestLoader/clears_cache_on_batch_with_WithClearCacheOnBatch (0.02s)
dataloader_test.go:370: expected a second batch, got [][]string{[]string{"1"}}
--- FAIL: TestLoader (0.00s)
--- FAIL: TestLoader/clears_cache_on_batch_with_WithClearCacheOnBatch (0.02s)
dataloader_test.go:370: expected a second batch, got [][]string{[]string{"1"}}
coverage: 86.0% of statements
This changes the test assertion to avoid test flake. Fixes #76.
I was unable to find any data races using the
-race
flag for testing. The existing test would rarely fail 0.001% of the time locally on my machine. I changed the test so it's not digging into the cache (which relies on locking external to it's implementation--maybe something to follow up on separately).I haven't been able to reproduce any test flakiness with this new approach.