Remove tests dependency from nullreader test
Previously we had a dependency to the tests package. As the nullreader package is in the pkg directory it should be publicly available. However, having the tests dependency could lead to a transitive dependency to an internal package, if the tests package would import one. Thus, we removed it.
This commit is contained in:
@ -3,10 +3,12 @@ package nullreader
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"gitlab.hpi.de/codeocean/codemoon/poseidon/tests"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
const shortTimeout = 100 * time.Millisecond
|
||||
|
||||
func TestNullReaderDoesNotReturnImmediately(t *testing.T) {
|
||||
reader := &NullReader{}
|
||||
readerReturned := make(chan bool)
|
||||
@ -16,5 +18,14 @@ func TestNullReaderDoesNotReturnImmediately(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
close(readerReturned)
|
||||
}()
|
||||
assert.False(t, tests.ChannelReceivesSomething(readerReturned, tests.ShortTimeout))
|
||||
|
||||
var received bool
|
||||
select {
|
||||
case <-readerReturned:
|
||||
received = true
|
||||
case <-time.After(shortTimeout):
|
||||
received = false
|
||||
}
|
||||
|
||||
assert.False(t, received)
|
||||
}
|
||||
|
Reference in New Issue
Block a user