read deadline test method
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing

This commit is contained in:
Jake Hillion 2021-05-12 00:52:46 +01:00
parent 81dce2855d
commit 068b544b7d
2 changed files with 9 additions and 2 deletions

View File

@ -1,6 +1,9 @@
package mocks
import "net"
import (
"net"
"time"
)
type MockPerfectBiPacketConn struct {
directionA chan []byte
@ -44,6 +47,10 @@ func (c MockPerfectPacketConn) LocalAddr() net.Addr {
}
}
func (c MockPerfectPacketConn) SetReadDeadline(time.Time) error {
return nil
}
func (c MockPerfectPacketConn) ReadFromUDP(b []byte) (int, *net.UDPAddr, error) {
p := <-c.inbound
return copy(b, p), &net.UDPAddr{

View File

@ -64,7 +64,7 @@ func TestFlow_Produce(t *testing.T) {
flowA.isAlive = true
go func() {
err := flowA.readQueuePacket(context.Background(), testConn.SideB())
_, err := flowA.readPacket(context.Background(), testConn.SideB())
assert.Nil(t, err)
}()
p, err := flowA.Produce(context.Background(), testMac)