Skip to content

Commit

Permalink
Cleanup external sandbox from test
Browse files Browse the repository at this point in the history
- otherwise "ValidKey" file is left behind

Signed-off-by: Alessandro Boch <aboch@docker.com>
  • Loading branch information
aboch committed Sep 11, 2015
1 parent 614f396 commit 44763fa
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions libnetwork_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ func TestMain(m *testing.M) {

err := controller.ConfigureNetworkDriver(bridgeNetType, genericOption)
if err != nil {
//m.Fatal(err)
os.Exit(1)
}

Expand Down Expand Up @@ -1243,6 +1242,7 @@ func TestExternalKey(t *testing.T) {
if err := cnt.Delete(); err != nil {
t.Fatal(err)
}
osl.GC()
}()

// Join endpoint to sandbox before SetKey
Expand Down Expand Up @@ -1270,8 +1270,14 @@ func TestExternalKey(t *testing.T) {
}

// Create a new OS sandbox using the osl API before using it in SetKey
if _, err := osl.NewSandbox("ValidKey", true); err != nil {
if extOsBox, err := osl.NewSandbox("ValidKey", true); err != nil {
t.Fatalf("Failed to create new osl sandbox")
} else {
defer func() {
if err := extOsBox.Destroy(); err != nil {
log.Warnf("Failed to remove os sandbox: %v", err)
}
}()
}

if err := sbox.SetKey("ValidKey"); err != nil {
Expand Down

0 comments on commit 44763fa

Please sign in to comment.