diff options
author | Kir Kolyshkin <kolyshkin@gmail.com> | 2018-05-10 12:01:50 -0700 |
---|---|---|
committer | Kir Kolyshkin <kolyshkin@gmail.com> | 2018-05-10 12:53:37 -0700 |
commit | d8fd6137a1f6d95a2bcdfeb6e1dfa6b816790c5e (patch) | |
tree | 73a309d5f1ff087842c39f58721a11c5a7e47e57 /daemon/oci_linux_test.go | |
parent | f4ebcb42ac527b24ab54525d5824478fcd2960c0 (diff) | |
download | docker-d8fd6137a1f6d95a2bcdfeb6e1dfa6b816790c5e.tar.gz |
daemon.getSourceMount(): fix for / mount point
A recent optimization in getSourceMount() made it return an error
in case when the found mount point is "/". This prevented bind-mounted
volumes from working in such cases.
A (rather trivial but adeqate) unit test case is added.
Fixes: 871c957242 ("getSourceMount(): simplify")
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Diffstat (limited to 'daemon/oci_linux_test.go')
-rw-r--r-- | daemon/oci_linux_test.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/daemon/oci_linux_test.go b/daemon/oci_linux_test.go index 5f2731b8d6..e28fac004e 100644 --- a/daemon/oci_linux_test.go +++ b/daemon/oci_linux_test.go @@ -1,6 +1,7 @@ package daemon // import "github.com/docker/docker/daemon" import ( + "os" "testing" containertypes "github.com/docker/docker/api/types/container" @@ -86,3 +87,16 @@ func TestIpcPrivateVsReadonly(t *testing.T) { assert.Check(t, is.Equal(false, inSlice(m.Options, "ro"))) } } + +func TestGetSourceMount(t *testing.T) { + // must be able to find source mount for / + mnt, _, err := getSourceMount("/") + assert.NilError(t, err) + assert.Equal(t, mnt, "/") + + // must be able to find source mount for current directory + cwd, err := os.Getwd() + assert.NilError(t, err) + _, _, err = getSourceMount(cwd) + assert.NilError(t, err) +} |