From edc346a6b3edb092efbea84e92e4d4611cdc5944 Mon Sep 17 00:00:00 2001 From: Julien Neuhart Date: Tue, 20 Aug 2019 10:51:32 +0200 Subject: [PATCH] removing testfunc as it no more needed --- test/testfunc.go | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 test/testfunc.go diff --git a/test/testfunc.go b/test/testfunc.go deleted file mode 100644 index 93dac631..00000000 --- a/test/testfunc.go +++ /dev/null @@ -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) -}