Skip to content

Commit

Permalink
fix tests after path upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
kmulvey committed Dec 7, 2022
1 parent ef3d79a commit 47f4f4a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
6 changes: 2 additions & 4 deletions internal/app/imagedup/files_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ func TestStreamFiles(t *testing.T) {
close(done)
}()

files, err := path.ListFiles("./testimages")
files, err := path.List("./testimages", path.NewFileListFilter())
assert.NoError(t, err)
files = path.OnlyFiles(files)
var fileNames = path.OnlyNames(files)

id.streamFiles(context.Background(), fileNames)
Expand Down Expand Up @@ -65,9 +64,8 @@ func TestStreamFilesDedup(t *testing.T) {
close(done)
}()

files, err := path.ListFiles("./testimages")
files, err := path.List("./testimages", path.NewFileListFilter())
assert.NoError(t, err)
files = path.OnlyFiles(files)
var fileNames = path.OnlyNames(files)

id.streamFiles(context.Background(), fileNames)
Expand Down
10 changes: 5 additions & 5 deletions internal/app/imagedup/hash/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ func TestCache(t *testing.T) {
assert.NoError(t, err)
assert.NotNil(t, cache)

files, err := path.ListFiles("../testimages")
dirs, err := path.List("../testimages", path.NewFileListFilter())
assert.NoError(t, err)
var fileNames = path.OnlyNames(path.OnlyFiles(files))
var fileNames = path.OnlyNames(dirs)

for i, file := range fileNames {
_, err = cache.GetHash(i, file)
Expand Down Expand Up @@ -87,11 +87,11 @@ func BenchmarkGetHash(b *testing.B) {
var cache, err = NewCache(cacheFile, "glob", goutils.RandomString(5), 3)
assert.NoError(b, err)

files, err := path.ListFiles("../testimages")
dirs, err := path.List("../testimages", path.NewFileListFilter())
assert.NoError(b, err)
var fileNames = path.OnlyNames(path.OnlyFiles(files))
var fileNames = path.OnlyNames(dirs)

for i, file := range files {
for i, file := range dirs {
_, err = cache.GetHash(i, file.AbsolutePath)
assert.NoError(b, err)
}
Expand Down
4 changes: 2 additions & 2 deletions internal/app/imagedup/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ func TestNewImageDup(t *testing.T) {
dup, err = NewImageDup("TestNewImageDup", cacheFile, "glob", 2, 3, 10, true)
assert.NoError(t, err)

files, err := path.ListFiles("./testimages")
dirs, err := path.List("./testimages", path.NewFileListFilter())
assert.NoError(t, err)
var fileNames = path.OnlyNames(path.OnlyFiles(files))
var fileNames = path.OnlyNames(dirs)

var results, errors = dup.Run(context.Background(), fileNames)
var done = make(chan struct{})
Expand Down

0 comments on commit 47f4f4a

Please sign in to comment.