removing testfunc as it no more needed

This commit is contained in:
Julien Neuhart
2019-08-20 10:51:32 +02:00
parent 1e3fc97f2b
commit edc346a6b3

View File

@@ -1,35 +0,0 @@
package test
import (
"io"
"os"
"testing"
"github.com/stretchr/testify/assert"
"golang.org/x/sync/errgroup"
)
// AssertDirectoryEmpty checks if given directory
// is empty.
func AssertDirectoryEmpty(t *testing.T, directory string) {
f, err := os.Open(directory)
assert.Nil(t, err)
defer f.Close() // nolint: errcheck
_, err = f.Readdir(1)
if err == nil {
return
}
assert.Equal(t, io.EOF, err)
}
// AssertConcurrent runs all functions simultaneously
// and wait until execution has completed
// or an error is encountered.
func AssertConcurrent(t *testing.T, fn func() error, amount int) {
eg := errgroup.Group{}
for i := 0; i < amount; i++ {
eg.Go(fn)
}
err := eg.Wait()
assert.NoError(t, err)
}