mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
test: delay slightly between filestore test permutations (#4382)
This is to try to prevent test failing due to trying to access the tempdir while it is being torn down. (go issue: https://github.com/golang/go/issues/43547) ``` === RUN TestFileStoreMsgBlkFailOnKernelFaultLostDataReporting/AES-GCM-S2 testing.go:1225: TempDir RemoveAll cleanup: unlinkat ./TestFileStoreMsgBlkFailOnKernelFaultLostDataReportingAES-GCM-S23605508670/001/msgs: directory not empty --- FAIL: TestFileStoreMsgBlkFailOnKernelFaultLostDataReporting (0.02s) ``` Also increases timeout slightly of `TestFileStoreNewWriteIndexInfo` which runs close to 1ms deadline sometimes: ``` === FAIL: server TestFileStoreNewWriteIndexInfo/None-None (4.85s) | filestore_test.go:5489: Unexpected elapsed time: 1.054065ms | --- FAIL: TestFileStoreNewWriteIndexInfo/None-None (4.85s) ```
This commit is contained in:
@@ -50,6 +50,7 @@ func testFileStoreAllPermutations(t *testing.T, fn func(t *testing.T, fcfg FileS
|
||||
t.Run(subtestName, func(t *testing.T) {
|
||||
fcfg.StoreDir = t.TempDir()
|
||||
fn(t, fcfg)
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -5484,9 +5485,9 @@ func TestFileStoreNewWriteIndexInfo(t *testing.T) {
|
||||
t.Fatalf("Unexpected error: %v", err)
|
||||
}
|
||||
elapsed := time.Since(start)
|
||||
if elapsed > time.Millisecond {
|
||||
if elapsed > 3*time.Millisecond {
|
||||
mb.mu.Unlock()
|
||||
t.Fatalf("Unexpected elapsed time: %v", elapsed)
|
||||
t.Errorf("Unexpected elapsed time: %v", elapsed)
|
||||
}
|
||||
fi, err := os.Stat(mb.ifn)
|
||||
mb.mu.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user