test: fix racy test ReaderNoFollow
Due to the race between `Read()` and context cancellation, error might be returned which we can safely ignore. Signed-off-by: Andrey Smirnov <smirnov.andrey@gmail.com>
This commit is contained in:
parent
3d8418a689
commit
13c0052a6c
@ -6,6 +6,7 @@ package kmsg_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
@ -82,6 +83,13 @@ LOOP:
|
||||
break LOOP
|
||||
}
|
||||
|
||||
if closed && errors.Is(packet.Err, os.ErrClosed) {
|
||||
// ignore 'file already closed' error as it might happen
|
||||
// from the branch below depending on whether context cancel or
|
||||
// read() finishes first
|
||||
continue
|
||||
}
|
||||
|
||||
assert.NoError(t, packet.Err)
|
||||
|
||||
messageCount++
|
||||
|
Loading…
x
Reference in New Issue
Block a user