mirror of
https://github.com/clearlinux/docker.git
synced 2026-10-03 23:38:24 +00: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:
@@ -10,6 +10,7 @@ import (
|
||||
|
||||
func TestNetworkNat(t *testing.T) {
|
||||
testRequires(t, SameHostDaemon)
|
||||
defer deleteAllContainers()
|
||||
|
||||
iface, err := net.InterfaceByName("eth0")
|
||||
if err != nil {
|
||||
@@ -56,7 +57,6 @@ func TestNetworkNat(t *testing.T) {
|
||||
if out, _, err = runCommandWithOutput(killCmd); err != nil {
|
||||
t.Fatalf("failed to kill container: %s, %v", out, err)
|
||||
}
|
||||
deleteAllContainers()
|
||||
|
||||
logDone("network - make sure nat works through the host")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user