fix TestExecWithUserAfterLiveRestore
| ... | ... |
@@ -2804,11 +2804,15 @@ func (s *DockerDaemonSuite) TestExecWithUserAfterLiveRestore(c *check.C) {
|
| 2804 | 2804 |
testRequires(c, DaemonIsLinux) |
| 2805 | 2805 |
s.d.StartWithBusybox(c, "--live-restore") |
| 2806 | 2806 |
|
| 2807 |
- 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")
|
|
| 2807 |
+ 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")
|
|
| 2808 | 2808 |
c.Assert(err, check.IsNil, check.Commentf("Output: %s", out))
|
| 2809 | 2809 |
|
| 2810 | 2810 |
s.d.WaitRun("top")
|
| 2811 | 2811 |
|
| 2812 |
+ // Wait for shell command to be completed |
|
| 2813 |
+ _, 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`)
|
|
| 2814 |
+ c.Assert(err, check.IsNil, check.Commentf("Timeout waiting for shell command to be completed"))
|
|
| 2815 |
+ |
|
| 2812 | 2816 |
out1, err := s.d.Cmd("exec", "-u", "test", "top", "id")
|
| 2813 | 2817 |
// uid=100(test) gid=101(test) groups=101(test) |
| 2814 | 2818 |
c.Assert(err, check.IsNil, check.Commentf("Output: %s", out1))
|