1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #32463 from FengtuWang/fix_TestExecWithUserAfterLiveRestore2

fix TestExecWithUserAfterLiveRestore
This commit is contained in:
Victor Vieux 2017-04-12 16:52:35 -07:00 committed by GitHub
commit bc4560e512

View file

@ -2804,11 +2804,15 @@ func (s *DockerDaemonSuite) TestExecWithUserAfterLiveRestore(c *check.C) {
testRequires(c, DaemonIsLinux)
s.d.StartWithBusybox(c, "--live-restore")
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")
out, err := s.d.Cmd("run", "-d", "--name=top", "busybox", "sh", "-c", "addgroup -S test && adduser -S -G test test -D -s /bin/sh && touch /adduser_end && top")
c.Assert(err, check.IsNil, check.Commentf("Output: %s", out))
s.d.WaitRun("top")
// Wait for shell command to be completed
_, err = s.d.Cmd("exec", "top", "sh", "-c", `for i in $(seq 1 5); do if [ -e /adduser_end ]; then rm -f /adduser_end && break; else sleep 1 && false; fi; done`)
c.Assert(err, check.IsNil, check.Commentf("Timeout waiting for shell command to be completed"))
out1, err := s.d.Cmd("exec", "-u", "test", "top", "id")
// uid=100(test) gid=101(test) groups=101(test)
c.Assert(err, check.IsNil, check.Commentf("Output: %s", out1))