summaryrefslogtreecommitdiffhomepage
path: root/test/e2e
diff options
context:
space:
mode:
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/integration_test.go57
-rw-r--r--test/e2e/regression_test.go2
2 files changed, 53 insertions, 6 deletions
diff --git a/test/e2e/integration_test.go b/test/e2e/integration_test.go
index 8425abecb..d07ed6ba5 100644
--- a/test/e2e/integration_test.go
+++ b/test/e2e/integration_test.go
@@ -260,12 +260,10 @@ func TestMemLimit(t *testing.T) {
d := dockerutil.MakeContainer(ctx, t)
defer d.CleanUp(ctx)
- // N.B. Because the size of the memory file may grow in large chunks,
- // there is a minimum threshold of 1GB for the MemTotal figure.
- allocMemory := 1024 * 1024 // In kb.
+ allocMemoryKb := 50 * 1024
out, err := d.Run(ctx, dockerutil.RunOpts{
Image: "basic/alpine",
- Memory: allocMemory * 1024, // In bytes.
+ Memory: allocMemoryKb * 1024, // In bytes.
}, "sh", "-c", "cat /proc/meminfo | grep MemTotal: | awk '{print $2}'")
if err != nil {
t.Fatalf("docker run failed: %v", err)
@@ -285,7 +283,7 @@ func TestMemLimit(t *testing.T) {
if err != nil {
t.Fatalf("failed to parse %q: %v", out, err)
}
- if want := uint64(allocMemory); got != want {
+ if want := uint64(allocMemoryKb); got != want {
t.Errorf("MemTotal got: %d, want: %d", got, want)
}
}
@@ -494,6 +492,55 @@ func TestLink(t *testing.T) {
}
}
+// This test ensures we can run ping without errors.
+func TestPing4Loopback(t *testing.T) {
+ if testutil.IsRunningWithHostNet() {
+ // TODO(gvisor.dev/issue/5011): support ICMP sockets in hostnet and enable
+ // this test.
+ t.Skip("hostnet only supports TCP/UDP sockets, so ping is not supported.")
+ }
+
+ ctx := context.Background()
+ d := dockerutil.MakeContainer(ctx, t)
+ defer d.CleanUp(ctx)
+
+ if got, err := d.Run(ctx, dockerutil.RunOpts{
+ Image: "basic/ping4test",
+ }, "/root/ping4.sh"); err != nil {
+ t.Fatalf("docker run failed: %s", err)
+ } else if got != "" {
+ t.Errorf("test failed:\n%s", got)
+ }
+}
+
+// This test ensures we can enable ipv6 on loopback and run ping6 without
+// errors.
+func TestPing6Loopback(t *testing.T) {
+ if testutil.IsRunningWithHostNet() {
+ // TODO(gvisor.dev/issue/5011): support ICMP sockets in hostnet and enable
+ // this test.
+ t.Skip("hostnet only supports TCP/UDP sockets, so ping6 is not supported.")
+ }
+
+ ctx := context.Background()
+ d := dockerutil.MakeContainer(ctx, t)
+ defer d.CleanUp(ctx)
+
+ if got, err := d.Run(ctx, dockerutil.RunOpts{
+ Image: "basic/ping6test",
+ // The CAP_NET_ADMIN capability is required to use the `ip` utility, which
+ // we use to enable ipv6 on loopback.
+ //
+ // By default, ipv6 loopback is not enabled by runsc, because docker does
+ // not assign an ipv6 address to the test container.
+ CapAdd: []string{"NET_ADMIN"},
+ }, "/root/ping6.sh"); err != nil {
+ t.Fatalf("docker run failed: %s", err)
+ } else if got != "" {
+ t.Errorf("test failed:\n%s", got)
+ }
+}
+
func TestMain(m *testing.M) {
dockerutil.EnsureSupportedDockerVersion()
flag.Parse()
diff --git a/test/e2e/regression_test.go b/test/e2e/regression_test.go
index 70bbe5121..84564cdaa 100644
--- a/test/e2e/regression_test.go
+++ b/test/e2e/regression_test.go
@@ -35,7 +35,7 @@ func TestBindOverlay(t *testing.T) {
// Run the container.
got, err := d.Run(ctx, dockerutil.RunOpts{
Image: "basic/ubuntu",
- }, "bash", "-c", "nc -l -U /var/run/sock & p=$! && sleep 1 && echo foobar-asdf | nc -U /var/run/sock && wait $p")
+ }, "bash", "-c", "nc -q -1 -l -U /var/run/sock & p=$! && sleep 1 && echo foobar-asdf | nc -q 0 -U /var/run/sock && wait $p")
if err != nil {
t.Fatalf("docker run failed: %v", err)
}