mirror of
https://github.com/kemko/nomad.git
synced 2026-01-08 11:25:41 +03:00
Removing the container after running script check
This commit is contained in:
@@ -119,6 +119,7 @@ func TestDockerScriptCheck(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("error creating container: %v", err)
|
||||
}
|
||||
defer removeContainer(client, container.ID)
|
||||
|
||||
if err := client.StartContainer(container.ID, &docker.HostConfig{}); err != nil {
|
||||
t.Fatalf("error starting container", err)
|
||||
@@ -147,3 +148,9 @@ func TestDockerScriptCheck(t *testing.T) {
|
||||
t.Fatalf("exitcode expected: %v, actual: %v", expectedExitCode, res.ExitCode)
|
||||
}
|
||||
}
|
||||
|
||||
// removeContainer kills and removes a container
|
||||
func removeContainer(client *docker.Client, containerID string) {
|
||||
client.KillContainer(docker.KillContainerOptions{ID: containerID})
|
||||
client.RemoveContainer(docker.RemoveContainerOptions{ID: containerID, Force: true})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user