2014-02-25 11:17:48 -05:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
2016-11-09 17:43:08 -05:00
|
|
|
"time"
|
2015-04-18 12:46:47 -04:00
|
|
|
|
2016-12-30 12:23:00 -05:00
|
|
|
"github.com/docker/docker/integration-cli/checker"
|
2017-04-11 15:18:30 -04:00
|
|
|
"github.com/docker/docker/integration-cli/cli"
|
2015-04-18 12:46:47 -04:00
|
|
|
"github.com/go-check/check"
|
2014-02-25 11:17:48 -05:00
|
|
|
)
|
|
|
|
|
2015-04-18 12:46:47 -04:00
|
|
|
func (s *DockerSuite) TestKillDifferentUserContainer(c *check.C) {
|
2016-02-24 16:33:25 -05:00
|
|
|
// TODO Windows: Windows does not yet support -u (Feb 2016).
|
2015-08-28 13:36:42 -04:00
|
|
|
testRequires(c, DaemonIsLinux)
|
2017-04-11 15:18:30 -04:00
|
|
|
out := cli.DockerCmd(c, "run", "-u", "daemon", "-d", "busybox", "top").Combined()
|
2015-04-06 09:21:18 -04:00
|
|
|
cleanedContainerID := strings.TrimSpace(out)
|
2017-04-11 15:18:30 -04:00
|
|
|
cli.WaitRun(c, cleanedContainerID)
|
2014-08-27 19:34:37 -04:00
|
|
|
|
2017-04-11 15:18:30 -04:00
|
|
|
cli.DockerCmd(c, "kill", cleanedContainerID)
|
|
|
|
cli.WaitExited(c, cleanedContainerID, 10*time.Second)
|
2014-08-27 19:34:37 -04:00
|
|
|
|
2017-04-11 15:18:30 -04:00
|
|
|
out = cli.DockerCmd(c, "ps", "-q").Combined()
|
2015-10-28 00:18:26 -04:00
|
|
|
c.Assert(out, checker.Not(checker.Contains), cleanedContainerID, check.Commentf("killed container is still running"))
|
|
|
|
|
2014-08-27 19:34:37 -04:00
|
|
|
}
|