Fix race conditions in tests

This commit is contained in:
Deluan 2022-11-26 15:07:09 -05:00
parent 0bb133a6ac
commit 88823fca76
4 changed files with 24 additions and 13 deletions

View file

@ -19,9 +19,9 @@ var _ = Describe("walk_dir_tree", func() {
It("reads all info correctly", func() {
var collected = dirMap{}
results := make(walkResults, 5000)
var err error
var errC = make(chan error)
go func() {
err = walkDirTree(context.TODO(), baseDir, results)
errC <- walkDirTree(context.Background(), baseDir, results)
}()
for {
@ -32,7 +32,7 @@ var _ = Describe("walk_dir_tree", func() {
collected[stats.Path] = stats
}
Expect(err).To(BeNil())
Eventually(errC).Should(Receive(nil))
Expect(collected[baseDir]).To(MatchFields(IgnoreExtras, Fields{
"HasImages": BeTrue(),
"HasPlaylist": BeFalse(),