mirror of
https://github.com/moby/moby.git
synced 2025-12-06 07:41:18 +03:00
Better test cleanup with defer
This fixes a few misuses of `deleteAllContainers()` cleanup method in integration-cli suite by moving call to the beginning of the method and guaranteeing their execution (including panics) with `defer`s. Also added some forgotten cleanup calls while I'm at it. Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
This commit is contained in:
@@ -56,6 +56,8 @@ func TestRunRedirectStdout(t *testing.T) {
|
||||
|
||||
// Test recursive bind mount works by default
|
||||
func TestRunWithVolumesIsRecursive(t *testing.T) {
|
||||
defer deleteAllContainers()
|
||||
|
||||
tmpDir, err := ioutil.TempDir("", "docker_recursive_mount_test")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -87,7 +89,5 @@ func TestRunWithVolumesIsRecursive(t *testing.T) {
|
||||
t.Fatal("Recursive bind mount test failed. Expected file not found")
|
||||
}
|
||||
|
||||
deleteAllContainers()
|
||||
|
||||
logDone("run - volumes are bind mounted recursively")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user