File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 "fmt"
55 "os"
66 "strings"
7+ "sync"
78
89 "github.com/pkg/errors"
910)
@@ -147,12 +148,19 @@ func (s *Scenario) clean() {
147148}
148149
149150func (s * Scenario ) shutdown () {
150- // Kill the services in the opposite order.
151+ // Kill the services in parallel. We still iterate in reverse order
152+ // to respect service dependencies, but we kill them concurrently.
153+ var wg sync.WaitGroup
151154 for i := len (s .services ) - 1 ; i >= 0 ; i -- {
152- if err := s .services [i ].Kill (); err != nil {
153- logger .Log ("Unable to kill service" , s .services [i ].Name (), ":" , err .Error ())
154- }
155+ wg .Add (1 )
156+ go func (service Service ) {
157+ defer wg .Done ()
158+ if err := service .Kill (); err != nil {
159+ logger .Log ("Unable to kill service" , service .Name (), ":" , err .Error ())
160+ }
161+ }(s .services [i ])
155162 }
163+ wg .Wait ()
156164
157165 // Ensure there are no leftover containers.
158166 if out , err := RunCommandAndGetOutput (
You can’t perform that action at this time.
0 commit comments