|
@@ -3,6 +3,7 @@
|
|
|
package main
|
|
|
|
|
|
import (
|
|
|
+ "bufio"
|
|
|
"bytes"
|
|
|
"encoding/json"
|
|
|
"fmt"
|
|
@@ -2822,7 +2823,7 @@ func (s *DockerDaemonSuite) TestExecWithUserAfterLiveRestore(c *check.C) {
|
|
|
out, err := s.d.Cmd("run", "-d", "--name=top", "busybox", "sh", "-c", "addgroup -S test && adduser -S -G test test -D -s /bin/sh && top")
|
|
|
c.Assert(err, check.IsNil, check.Commentf("Output: %s", out))
|
|
|
|
|
|
- waitRun("top")
|
|
|
+ s.d.WaitRun("top")
|
|
|
|
|
|
out1, err := s.d.Cmd("exec", "-u", "test", "top", "id")
|
|
|
// uid=100(test) gid=101(test) groups=101(test)
|
|
@@ -2838,3 +2839,36 @@ func (s *DockerDaemonSuite) TestExecWithUserAfterLiveRestore(c *check.C) {
|
|
|
out, err = s.d.Cmd("stop", "top")
|
|
|
c.Assert(err, check.IsNil, check.Commentf("Output: %s", out))
|
|
|
}
|
|
|
+
|
|
|
+func (s *DockerDaemonSuite) TestRemoveContainerAfterLiveRestore(c *check.C) {
|
|
|
+ testRequires(c, DaemonIsLinux, overlayFSSupported, SameHostDaemon)
|
|
|
+ s.d.StartWithBusybox(c, "--live-restore", "--storage-driver", "overlay")
|
|
|
+ out, err := s.d.Cmd("run", "-d", "--name=top", "busybox", "top")
|
|
|
+ c.Assert(err, check.IsNil, check.Commentf("Output: %s", out))
|
|
|
+
|
|
|
+ s.d.WaitRun("top")
|
|
|
+
|
|
|
+ // restart daemon.
|
|
|
+ s.d.Restart(c, "--live-restore", "--storage-driver", "overlay")
|
|
|
+
|
|
|
+ out, err = s.d.Cmd("stop", "top")
|
|
|
+ c.Assert(err, check.IsNil, check.Commentf("Output: %s", out))
|
|
|
+
|
|
|
+ // test if the rootfs mountpoint still exist
|
|
|
+ mountpoint, err := s.d.InspectField("top", ".GraphDriver.Data.MergedDir")
|
|
|
+ c.Assert(err, check.IsNil)
|
|
|
+ f, err := os.Open("/proc/self/mountinfo")
|
|
|
+ c.Assert(err, check.IsNil)
|
|
|
+ defer f.Close()
|
|
|
+ sc := bufio.NewScanner(f)
|
|
|
+ for sc.Scan() {
|
|
|
+ line := sc.Text()
|
|
|
+ if strings.Contains(line, mountpoint) {
|
|
|
+ c.Fatalf("mountinfo should not include the mountpoint of stop container")
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ out, err = s.d.Cmd("rm", "top")
|
|
|
+ c.Assert(err, check.IsNil, check.Commentf("Output: %s", out))
|
|
|
+
|
|
|
+}
|