Skip to content

Commit

Permalink
squash: remove TmpFolder.ReadDir and partially revert querylog test
Browse files Browse the repository at this point in the history
  • Loading branch information
ThinkChaos committed Dec 1, 2023
1 parent adb970a commit c5cc112
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
7 changes: 0 additions & 7 deletions helpertest/tmpdata.go
Expand Up @@ -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
Expand Down
9 changes: 7 additions & 2 deletions querylog/file_writer_test.go
Expand Up @@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"io"
"io/fs"
"os"
"time"

Expand Down Expand Up @@ -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))
})
})
})
Expand Down

0 comments on commit c5cc112

Please sign in to comment.