mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-14 13:45:06 +00:00
Merge pull request #46293 from nicksardo/chaosmonkey-defer-stop
Automatic merge from submit-queue (batch tested with PRs 46149, 45897, 46293, 46296, 46194) Chaosmonkey - Signal stop to tests and wait for done when disruption fails **What this PR does / why we need it**: Prevents tests from leaking resources because their Teardown was never called when test disruption fails. **Which issue this PR fixes** First problem of #45842 **Release note**: ```release-note NONE ```
This commit is contained in:
@@ -98,14 +98,17 @@ func (cm *chaosmonkey) Do() {
|
|||||||
sem.waitForReadyOrDone()
|
sem.waitForReadyOrDone()
|
||||||
}
|
}
|
||||||
|
|
||||||
By("Starting disruption")
|
defer func() {
|
||||||
cm.disruption()
|
|
||||||
By("Disruption complete; stopping async validations")
|
|
||||||
close(stopCh)
|
close(stopCh)
|
||||||
By("Waiting for async validations to complete")
|
By("Waiting for async validations to complete")
|
||||||
for _, sem := range sems {
|
for _, sem := range sems {
|
||||||
sem.waitForDone()
|
sem.waitForDone()
|
||||||
}
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
By("Starting disruption")
|
||||||
|
cm.disruption()
|
||||||
|
By("Disruption complete; stopping async validations")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Semaphore is taken by a Test and provides: Ready(), for the Test to call when it's ready for the
|
// Semaphore is taken by a Test and provides: Ready(), for the Test to call when it's ready for the
|
||||||
|
Reference in New Issue
Block a user