diff options
author | Tamir Duberstein <tamird@google.com> | 2021-05-26 07:33:17 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2021-05-26 07:36:34 -0700 |
commit | 931f9709f00eec79833f5894f98e294af498bac6 (patch) | |
tree | 6f2c981ea44a99f101322af5364885da106484f6 /pkg/tcpip/tests | |
parent | fcad6f91a3f292b6b76be10f03baf05ee5245d3d (diff) |
Spawn dequeing task via the clock
...and use manual clocks in forwarding and link resolution tests.
Fixes #5141.
Fixes #6012.
PiperOrigin-RevId: 375939167
Diffstat (limited to 'pkg/tcpip/tests')
-rw-r--r-- | pkg/tcpip/tests/integration/BUILD | 1 | ||||
-rw-r--r-- | pkg/tcpip/tests/integration/link_resolution_test.go | 11 |
2 files changed, 3 insertions, 9 deletions
diff --git a/pkg/tcpip/tests/integration/BUILD b/pkg/tcpip/tests/integration/BUILD index 8802f36b2..181ef799e 100644 --- a/pkg/tcpip/tests/integration/BUILD +++ b/pkg/tcpip/tests/integration/BUILD @@ -48,7 +48,6 @@ go_test( size = "small", srcs = ["link_resolution_test.go"], deps = [ - "//pkg/context", "//pkg/tcpip", "//pkg/tcpip/buffer", "//pkg/tcpip/checker", diff --git a/pkg/tcpip/tests/integration/link_resolution_test.go b/pkg/tcpip/tests/integration/link_resolution_test.go index 16fd7a99a..27caa0c28 100644 --- a/pkg/tcpip/tests/integration/link_resolution_test.go +++ b/pkg/tcpip/tests/integration/link_resolution_test.go @@ -24,7 +24,6 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" - "gvisor.dev/gvisor/pkg/context" "gvisor.dev/gvisor/pkg/tcpip" "gvisor.dev/gvisor/pkg/tcpip/buffer" "gvisor.dev/gvisor/pkg/tcpip/checker" @@ -604,8 +603,6 @@ func TestForwardingWithLinkResolutionFailure(t *testing.T) { test.rx(incomingEndpoint, test.sourceAddr, test.destAddr) - var request channel.PacketInfo - var ok bool nudConfigs, err := s.NUDConfigurations(outgoingNICID, test.networkProtocolNumber) if err != nil { t.Fatalf("s.NUDConfigurations(%d, %d): %s", outgoingNICID, test.networkProtocolNumber, err) @@ -614,7 +611,8 @@ func TestForwardingWithLinkResolutionFailure(t *testing.T) { clock.RunImmediatelyScheduledJobs() for i := 0; i < int(nudConfigs.MaxMulticastProbes); i++ { - if request, ok = outgoingEndpoint.Read(); !ok { + request, ok := outgoingEndpoint.Read() + if !ok { t.Fatal("expected ARP packet through outgoing NIC") } @@ -628,10 +626,7 @@ func TestForwardingWithLinkResolutionFailure(t *testing.T) { // necessary because outgoing packets are dequeued asynchronously when // link resolution fails, and this dequeue is what triggers the ICMP // error. - // - // TODO(gvisor.dev/issue/6012): Replace with asynchronous read after we - // have integrated the stack clock with the dequeuing code. - reply, ok := incomingEndpoint.ReadContext(context.Background()) + reply, ok := incomingEndpoint.Read() if !ok { t.Fatal("expected ICMP packet through incoming NIC") } |