fix cipher-otc timeout test
This commit is contained in:
parent
366976e73a
commit
b51400d119
1 changed files with 8 additions and 2 deletions
|
@ -54,6 +54,7 @@ func TestReader(t *testing.T) {
|
||||||
|
|
||||||
err error
|
err error
|
||||||
result []byte
|
result []byte
|
||||||
|
limit bool
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "simple",
|
name: "simple",
|
||||||
|
@ -83,8 +84,9 @@ func TestReader(t *testing.T) {
|
||||||
name: "timeout",
|
name: "timeout",
|
||||||
r: iotest.TimeoutReader(bytes.NewBuffer(plaintext)),
|
r: iotest.TimeoutReader(bytes.NewBuffer(plaintext)),
|
||||||
prng: bytes.NewBuffer(randomBytes),
|
prng: bytes.NewBuffer(randomBytes),
|
||||||
result: ciphertext[:bytes.MinRead],
|
result: ciphertext,
|
||||||
err: iotest.ErrTimeout,
|
err: iotest.ErrTimeout,
|
||||||
|
limit: true,
|
||||||
},
|
},
|
||||||
} {
|
} {
|
||||||
t.Run(testCase.name, func(t *testing.T) {
|
t.Run(testCase.name, func(t *testing.T) {
|
||||||
|
@ -92,7 +94,11 @@ func TestReader(t *testing.T) {
|
||||||
|
|
||||||
buf, err := ioutil.ReadAll(r)
|
buf, err := ioutil.ReadAll(r)
|
||||||
require.ErrorIs(t, err, testCase.err)
|
require.ErrorIs(t, err, testCase.err)
|
||||||
|
if testCase.limit {
|
||||||
|
require.Equal(t, testCase.result[:len(buf)], buf)
|
||||||
|
} else {
|
||||||
require.Equal(t, testCase.result, buf)
|
require.Equal(t, testCase.result, buf)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue