summaryrefslogtreecommitdiffhomepage
path: root/test/packetimpact
diff options
context:
space:
mode:
authorAmanda Tait <atait@google.com>2020-09-11 13:26:33 -0700
committergVisor bot <gvisor-bot@google.com>2020-09-11 13:28:57 -0700
commit325f7036b051a705d5ae595d2f3c351084262532 (patch)
tree0c477ea72bb7ba83171806ca9774e726c9989f17 /test/packetimpact
parent490e5c83bd647639e36a9f7e871af33fa64b9bb1 (diff)
Use correct test device name in Fuchsia packetimpact
Packetimpact on Fuchsia was formerly using the Linux test device name. This change fixes that. PiperOrigin-RevId: 331211518
Diffstat (limited to 'test/packetimpact')
-rw-r--r--test/packetimpact/runner/dut.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/test/packetimpact/runner/dut.go b/test/packetimpact/runner/dut.go
index be7b52f18..d4c486f9c 100644
--- a/test/packetimpact/runner/dut.go
+++ b/test/packetimpact/runner/dut.go
@@ -171,11 +171,8 @@ func TestWithDUT(ctx context.Context, t *testing.T, mkDevice func(*dockerutil.Co
}},
}
- // Add ctrlNet as eth1 and testNet as eth2.
- const testNetDev = "eth2"
-
device := mkDevice(dut)
- remoteIPv6, remoteMAC, dutDeviceID := device.Prepare(ctx, t, runOpts, ctrlNet, testNet, containerAddr)
+ remoteIPv6, remoteMAC, dutDeviceID, testNetDev := device.Prepare(ctx, t, runOpts, ctrlNet, testNet, containerAddr)
// Create the Docker container for the testbench.
testbench := dockerutil.MakeNativeContainer(ctx, logger("testbench"))
@@ -282,8 +279,8 @@ func TestWithDUT(ctx context.Context, t *testing.T, mkDevice func(*dockerutil.Co
// DUT describes how to setup/teardown the dut for packetimpact tests.
type DUT interface {
// Prepare prepares the dut, starts posix_server and returns the IPv6, MAC
- // address and the interface ID for the testNet on DUT.
- Prepare(ctx context.Context, t *testing.T, runOpts dockerutil.RunOpts, ctrlNet, testNet *dockerutil.Network, containerAddr net.IP) (net.IP, net.HardwareAddr, uint32)
+ // address, the interface ID, and the interface name for the testNet on DUT.
+ Prepare(ctx context.Context, t *testing.T, runOpts dockerutil.RunOpts, ctrlNet, testNet *dockerutil.Network, containerAddr net.IP) (net.IP, net.HardwareAddr, uint32, string)
// Logs retrieves the logs from the dut.
Logs(ctx context.Context) (string, error)
}
@@ -301,7 +298,7 @@ func NewDockerDUT(c *dockerutil.Container) DUT {
}
// Prepare implements DUT.Prepare.
-func (dut *DockerDUT) Prepare(ctx context.Context, t *testing.T, runOpts dockerutil.RunOpts, ctrlNet, testNet *dockerutil.Network, containerAddr net.IP) (net.IP, net.HardwareAddr, uint32) {
+func (dut *DockerDUT) Prepare(ctx context.Context, t *testing.T, runOpts dockerutil.RunOpts, ctrlNet, testNet *dockerutil.Network, containerAddr net.IP) (net.IP, net.HardwareAddr, uint32, string) {
const containerPosixServerBinary = "/packetimpact/posix_server"
dut.c.CopyFiles(&runOpts, "/packetimpact", "test/packetimpact/dut/posix_server")
@@ -345,7 +342,9 @@ func (dut *DockerDUT) Prepare(ctx context.Context, t *testing.T, runOpts dockeru
t.Fatalf("unable to set IPv6 address on container %s", dut.c.Name)
}
}
- return remoteIPv6, dutDeviceInfo.MAC, dutDeviceInfo.ID
+ const testNetDev = "eth2"
+
+ return remoteIPv6, dutDeviceInfo.MAC, dutDeviceInfo.ID, testNetDev
}
// Logs implements DUT.Logs.