mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-16 12:22:17 +01:00
removing testfunc as it no more needed
This commit is contained in:
@@ -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)
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user