From 8f9e4542417421ee62ac952d1e04268520a75d8f Mon Sep 17 00:00:00 2001 From: Solomon Hykes Date: Tue, 2 Apr 2013 11:00:14 -0700 Subject: [PATCH] [unit tests] Cleanly kill all containers before nuking a temporary runtime --- runtime_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/runtime_test.go b/runtime_test.go index b8a6c429c9..d8e160fc0e 100644 --- a/runtime_test.go +++ b/runtime_test.go @@ -6,6 +6,7 @@ import ( "os" "os/exec" "os/user" + "sync" "testing" ) @@ -17,6 +18,15 @@ var unitTestStoreBase string var srv *Server func nuke(runtime *Runtime) error { + var wg sync.WaitGroup + for _, container := range runtime.List() { + wg.Add(1) + go func() { + container.Kill() + wg.Add(-1) + }() + } + wg.Wait() return os.RemoveAll(runtime.root) }