Defer test stop & cleanup

pull/6/head
Nick Sardo 2017-05-23 10:11:46 -07:00
parent 8e07e61a43
commit f40f45abc1
1 changed files with 8 additions and 5 deletions

View File

@ -98,14 +98,17 @@ func (cm *chaosmonkey) Do() {
sem.waitForReadyOrDone()
}
defer func() {
close(stopCh)
By("Waiting for async validations to complete")
for _, sem := range sems {
sem.waitForDone()
}
}()
By("Starting disruption")
cm.disruption()
By("Disruption complete; stopping async validations")
close(stopCh)
By("Waiting for async validations to complete")
for _, sem := range sems {
sem.waitForDone()
}
}
// Semaphore is taken by a Test and provides: Ready(), for the Test to call when it's ready for the