docker_cli_kill_test.go 773 B

12345678910111213141516171819202122232425
  1. package main
  2. import (
  3. "strings"
  4. "time"
  5. "github.com/docker/docker/integration-cli/checker"
  6. "github.com/docker/docker/integration-cli/cli"
  7. "github.com/go-check/check"
  8. )
  9. func (s *DockerSuite) TestKillDifferentUserContainer(c *check.C) {
  10. // TODO Windows: Windows does not yet support -u (Feb 2016).
  11. testRequires(c, DaemonIsLinux)
  12. out := cli.DockerCmd(c, "run", "-u", "daemon", "-d", "busybox", "top").Combined()
  13. cleanedContainerID := strings.TrimSpace(out)
  14. cli.WaitRun(c, cleanedContainerID)
  15. cli.DockerCmd(c, "kill", cleanedContainerID)
  16. cli.WaitExited(c, cleanedContainerID, 10*time.Second)
  17. out = cli.DockerCmd(c, "ps", "-q").Combined()
  18. c.Assert(out, checker.Not(checker.Contains), cleanedContainerID, check.Commentf("killed container is still running"))
  19. }