read deadline test method
This commit is contained in:
parent
81dce2855d
commit
068b544b7d
@ -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{
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user