summaryrefslogtreecommitdiffhomepage
path: root/test/e2e
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2021-07-20 20:53:33 -0700
committergVisor bot <gvisor-bot@google.com>2021-07-20 20:57:09 -0700
commit990cd1a950955e25dc8935a6aca61906307a0851 (patch)
treec24f7f684a73950b1e87388d07115d9989534659 /test/e2e
parent49d9ef49873dccf2adc414f0c2ea2c41a11b6941 (diff)
Don't kill container when volume is unmounted
The gofer session is killed when a gofer backed volume is unmounted. The gofer monitor catches the disconnect and kills the container. This changes the gofer monitor to only care about the rootfs connections, which cannot be unmounted. Fixes #6259 PiperOrigin-RevId: 385929039
Diffstat (limited to 'test/e2e')
-rw-r--r--test/e2e/integration_test.go33
1 files changed, 29 insertions, 4 deletions
diff --git a/test/e2e/integration_test.go b/test/e2e/integration_test.go
index f53417cab..9e22c9a7d 100644
--- a/test/e2e/integration_test.go
+++ b/test/e2e/integration_test.go
@@ -44,6 +44,12 @@ import (
// defaultWait is the default wait time used for tests.
const defaultWait = time.Minute
+func TestMain(m *testing.M) {
+ dockerutil.EnsureSupportedDockerVersion()
+ flag.Parse()
+ os.Exit(m.Run())
+}
+
// httpRequestSucceeds sends a request to a given url and checks that the status is OK.
func httpRequestSucceeds(client http.Client, server string, port int) error {
url := fmt.Sprintf("http://%s:%d", server, port)
@@ -712,8 +718,27 @@ func TestStdiosChown(t *testing.T) {
}
}
-func TestMain(m *testing.M) {
- dockerutil.EnsureSupportedDockerVersion()
- flag.Parse()
- os.Exit(m.Run())
+func TestUnmount(t *testing.T) {
+ ctx := context.Background()
+ d := dockerutil.MakeContainer(ctx, t)
+ defer d.CleanUp(ctx)
+
+ dir, err := ioutil.TempDir(testutil.TmpDir(), "sub-mount")
+ if err != nil {
+ t.Fatalf("TempDir(): %v", err)
+ }
+ opts := dockerutil.RunOpts{
+ Image: "basic/alpine",
+ Privileged: true, // Required for umount
+ Mounts: []mount.Mount{
+ {
+ Type: mount.TypeBind,
+ Source: dir,
+ Target: "/foo",
+ },
+ },
+ }
+ if _, err := d.Run(ctx, opts, "umount", "/foo"); err != nil {
+ t.Fatalf("docker run failed: %v", err)
+ }
}