Skip to content

Commit

Permalink
test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DanG100 committed Oct 24, 2024
1 parent cbc0de8 commit a2d8616
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func TestStreamPackets(t *testing.T) {
mgr.sendQueue.Write(pkt)
}
mgr.StreamPackets(ps)
time.Sleep(time.Millisecond) // Sleep long enough to drain the send queue.
time.Sleep(5 * time.Millisecond) // Sleep long enough to drain the send queue.

if d := cmp.Diff(ps.sendPackets, tt.wantSentPacket, protocmp.Transform()); d != "" {
t.Errorf("StreamPackets() failed: sent packet diff(-got,+want)\n:%s", d)
Expand Down Expand Up @@ -134,7 +134,7 @@ func TestManagePorts(t *testing.T) {
t.Fatalf("unexpected error on New(): %v", err)
}
builder[pktiopb.PortType_PORT_TYPE_NETDEV] = func(hpcm *pktiopb.HostPortControlMessage) (PortIO, error) {
return nil, nil
return &fakePort{}, nil
}
linkByName = func(name string) (netlink.Link, error) {
return &fakeLink{}, nil
Expand Down Expand Up @@ -162,6 +162,10 @@ type fakePort struct {
writtenData []*portWriteData
}

func (p *fakePort) Read([]byte) (int, error) {
return 0, nil
}

func (p *fakePort) Write(frame []byte, md *kernel.PacketMetadata) (int, error) {
p.writtenData = append(p.writtenData, &portWriteData{Frame: frame, MD: md})
return len(frame), nil
Expand Down

0 comments on commit a2d8616

Please sign in to comment.