mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
28 lines
545 B
Go
28 lines
545 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
"os"
|
||
|
"os/exec"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestRemoveContainerWithRemovedVolume(t *testing.T) {
|
||
|
cmd := exec.Command(dockerBinary, "run", "--name", "losemyvolumes", "-v", "/tmp/testing:/test", "busybox", "true")
|
||
|
if _, err := runCommand(cmd); err != nil {
|
||
|
t.Fatal(err)
|
||
|
}
|
||
|
|
||
|
if err := os.Remove("/tmp/testing"); err != nil {
|
||
|
t.Fatal(err)
|
||
|
}
|
||
|
|
||
|
cmd = exec.Command(dockerBinary, "rm", "-v", "losemyvolumes")
|
||
|
if _, err := runCommand(cmd); err != nil {
|
||
|
t.Fatal(err)
|
||
|
}
|
||
|
|
||
|
deleteAllContainers()
|
||
|
|
||
|
logDone("rm - removed volume")
|
||
|
}
|