diff options
Diffstat (limited to 'runsc/boot/loader_test.go')
-rw-r--r-- | runsc/boot/loader_test.go | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/runsc/boot/loader_test.go b/runsc/boot/loader_test.go index 5bc6f1646..3ce7855f6 100644 --- a/runsc/boot/loader_test.go +++ b/runsc/boot/loader_test.go @@ -15,6 +15,7 @@ package boot import ( + "io/ioutil" "os" "sync" "testing" @@ -150,6 +151,12 @@ func TestCreateMountNamespace(t *testing.T) { DisableSeccomp: true, } + testFile, err := ioutil.TempFile(os.TempDir(), "create-mount-namespace-") + if err != nil { + t.Fatalf("ioutil.TempFile() failed, err: %v", err) + } + defer os.RemoveAll(testFile.Name()) + testCases := []struct { name string // Spec that will be used to create the mount manager. Note @@ -202,7 +209,7 @@ func TestCreateMountNamespace(t *testing.T) { expectedPaths: []string{"/some/very/very/deep/path", "/proc", "/dev", "/sys"}, }, { - // Mounts are nested inside eachother. + // Mounts are nested inside each other. name: "nested mounts", spec: specs.Spec{ Root: &specs.Root{ @@ -219,6 +226,16 @@ func TestCreateMountNamespace(t *testing.T) { Type: "tmpfs", }, { + Destination: "/foo/qux", + Source: testFile.Name(), + Type: "bind", + }, + { + // File mounts with the same prefix. + Destination: "/foo/qux-quz", + Type: "tmpfs", + }, + { Destination: "/foo/bar", Type: "tmpfs", }, @@ -233,7 +250,8 @@ func TestCreateMountNamespace(t *testing.T) { }, }, }, - expectedPaths: []string{"/foo", "/foo/bar", "/foo/bar/baz", "/foo/some/very/very/deep/path", "/proc", "/dev", "/sys"}, + expectedPaths: []string{"/foo", "/foo/bar", "/foo/bar/baz", "/foo/qux", + "/foo/qux-quz", "/foo/some/very/very/deep/path", "/proc", "/dev", "/sys"}, }, } |