mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
daemon.cleanupMounts(): use mount.SingleEntryFilter
Use mount.SingleEntryFilter as we're only interested in a single entry. Test case data of TestShouldUnmountRoot is modified accordingly, as from now on: 1. `info` can't be nil; 2. the mountpoint check is not performed (as SingleEntryFilter guarantees it to be equal to daemon.root). Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This commit is contained in:
parent
bb934c6aca
commit
d3ebcde82a
2 changed files with 7 additions and 21 deletions
|
@ -179,12 +179,6 @@ func TestShouldUnmountRoot(t *testing.T) {
|
|||
info: &mount.Info{Root: "/docker", Mountpoint: "/docker"},
|
||||
expect: true,
|
||||
},
|
||||
{
|
||||
desc: "not a mountpoint",
|
||||
root: "/docker",
|
||||
info: nil,
|
||||
expect: false,
|
||||
},
|
||||
{
|
||||
desc: "root is at in a submount from `/`",
|
||||
root: "/foo/docker",
|
||||
|
@ -197,12 +191,6 @@ func TestShouldUnmountRoot(t *testing.T) {
|
|||
info: &mount.Info{Root: "/docker/volumes/1234657/_data", Mountpoint: "/docker"},
|
||||
expect: false,
|
||||
},
|
||||
{
|
||||
desc: "root is mounted in from a parent mount namespace different root dir",
|
||||
root: "/foo/bar",
|
||||
info: &mount.Info{Root: "/docker/volumes/1234657/_data", Mountpoint: "/foo/bar"},
|
||||
expect: false,
|
||||
},
|
||||
} {
|
||||
t.Run(test.desc, func(t *testing.T) {
|
||||
for _, options := range []struct {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue