summaryrefslogtreecommitdiffhomepage
path: root/test/iptables/iptables_test.go
diff options
context:
space:
mode:
authorZach Koopmans <zkoopmans@google.com>2020-07-08 13:24:58 -0700
committergVisor bot <gvisor-bot@google.com>2020-07-08 13:26:23 -0700
commitf3fa43cf237109c1e1cb0cf7ba63bb793cc2ff1f (patch)
tree34401d90d4d4e892020a11baf37311c1ec20aaa6 /test/iptables/iptables_test.go
parente1f11dea286789ffa116e357bea66ee6b422deae (diff)
Move all tests to new docker API.
Moves following to new dockerutil API: - //test/e2e:integration_test - //test/image:image_test - //test/iptables:iptables_test - //test/root:root_test - //test/packetimpact:packetimpact_test PiperOrigin-RevId: 320253118
Diffstat (limited to 'test/iptables/iptables_test.go')
-rw-r--r--test/iptables/iptables_test.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/test/iptables/iptables_test.go b/test/iptables/iptables_test.go
index 340f9426e..9dc64f655 100644
--- a/test/iptables/iptables_test.go
+++ b/test/iptables/iptables_test.go
@@ -15,6 +15,7 @@
package iptables
import (
+ "context"
"fmt"
"net"
"testing"
@@ -37,8 +38,9 @@ func singleTest(t *testing.T, test TestCase) {
t.Fatalf("no test found with name %q. Has it been registered?", test.Name())
}
- d := dockerutil.MakeDocker(t)
- defer d.CleanUp()
+ ctx := context.Background()
+ d := dockerutil.MakeContainer(ctx, t)
+ defer d.CleanUp(ctx)
// Create and start the container.
opts := dockerutil.RunOpts{
@@ -46,12 +48,12 @@ func singleTest(t *testing.T, test TestCase) {
CapAdd: []string{"NET_ADMIN"},
}
d.CopyFiles(&opts, "/runner", "test/iptables/runner/runner")
- if err := d.Spawn(opts, "/runner/runner", "-name", test.Name()); err != nil {
+ if err := d.Spawn(ctx, opts, "/runner/runner", "-name", test.Name()); err != nil {
t.Fatalf("docker run failed: %v", err)
}
// Get the container IP.
- ip, err := d.FindIP()
+ ip, err := d.FindIP(ctx)
if err != nil {
t.Fatalf("failed to get container IP: %v", err)
}
@@ -69,7 +71,7 @@ func singleTest(t *testing.T, test TestCase) {
// Wait for the final statement. This structure has the side effect
// that all container logs will appear within the individual test
// context.
- if _, err := d.WaitForOutput(TerminalStatement, TestTimeout); err != nil {
+ if _, err := d.WaitForOutput(ctx, TerminalStatement, TestTimeout); err != nil {
t.Fatalf("test failed: %v", err)
}
}