diff --git a/helpertest/tmpdata.go b/helpertest/tmpdata.go index a4c8df4a..c8fad1a7 100644 --- a/helpertest/tmpdata.go +++ b/helpertest/tmpdata.go @@ -105,13 +105,6 @@ func (tf *TmpFolder) JoinPath(name string) string { return filepath.Join(tf.Path, name) } -func (tf *TmpFolder) ReadDir() []fs.DirEntry { - files, err := os.ReadDir(tf.Path) - Expect(err).Should(Succeed()) - - return files -} - func (tf *TmpFolder) createFile(name string) (*os.File, *TmpFile) { var ( f *os.File diff --git a/querylog/file_writer_test.go b/querylog/file_writer_test.go index 91073ab0..583d6217 100644 --- a/querylog/file_writer_test.go +++ b/querylog/file_writer_test.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" "io" + "io/fs" "os" "time" @@ -115,11 +116,15 @@ var _ = Describe("FileWriter", func() { }) }) - Expect(tmpDir.ReadDir()).Should(HaveLen(2)) + Eventually(func(g Gomega) ([]fs.DirEntry, error) { + return os.ReadDir(tmpDir.Path) + }, "20s", "1s").Should(HaveLen(2)) writer.CleanUp() - Expect(tmpDir.ReadDir()).Should(HaveLen(1)) + Eventually(func(g Gomega) ([]fs.DirEntry, error) { + return os.ReadDir(tmpDir.Path) + }, "20s", "1s").Should(HaveLen(1)) }) }) })