Add runSleepingContainer in integration-cli
Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
parent
85dba4980e
commit
d6e7dc791f
3 changed files with 28 additions and 0 deletions
|
@ -1704,3 +1704,19 @@ func getInspectBody(c *check.C, version, id string) []byte {
|
|||
c.Assert(status, check.Equals, http.StatusOK)
|
||||
return body
|
||||
}
|
||||
|
||||
// Run a long running idle task in a background container using the
|
||||
// system-specific default image and command.
|
||||
func runSleepingContainer(c *check.C, extraArgs ...string) (string, int) {
|
||||
return runSleepingContainerInImage(c, defaultSleepImage, extraArgs...)
|
||||
}
|
||||
|
||||
// Run a long running idle task in a background container using the specified
|
||||
// image and the system-specific command.
|
||||
func runSleepingContainerInImage(c *check.C, image string, extraArgs ...string) (string, int) {
|
||||
args := []string{"run", "-d"}
|
||||
args = append(args, extraArgs...)
|
||||
args = append(args, image)
|
||||
args = append(args, defaultSleepCommand...)
|
||||
return dockerCmd(c, args...)
|
||||
}
|
||||
|
|
|
@ -7,4 +7,10 @@ const (
|
|||
isUnixCli = true
|
||||
|
||||
expectedFileChmod = "-rw-r--r--"
|
||||
|
||||
// On Unix variants, the busybox image comes with the `top` command which
|
||||
// runs indefinitely while still being interruptible by a signal.
|
||||
defaultSleepImage = "busybox"
|
||||
)
|
||||
|
||||
var defaultSleepCommand = []string{"top"}
|
||||
|
|
|
@ -8,4 +8,10 @@ const (
|
|||
|
||||
// this is the expected file permission set on windows: gh#11395
|
||||
expectedFileChmod = "-rwxr-xr-x"
|
||||
|
||||
// On Windows, the busybox image doesn't have the `top` command, so we rely
|
||||
// on `sleep` with a high duration.
|
||||
defaultSleepImage = "busybox"
|
||||
)
|
||||
|
||||
var defaultSleepCommand = []string{"sleep", "60"}
|
||||
|
|
Loading…
Add table
Reference in a new issue