mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 14:37:00 +00:00
Kubelet: Fix volumemanager test race
This commit is contained in:
parent
8b98e802ed
commit
45464f0349
@ -1226,8 +1226,16 @@ func Test_Run_Positive_VolumeMountControllerAttachEnabledRace(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("AddPodToVolume failed. Expected: <no error> Actual: <%v>", err)
|
||||
}
|
||||
runReconciler(reconciler)
|
||||
// Start the reconciler to fill ASW.
|
||||
stopChan, stoppedChan := make(chan struct{}), make(chan struct{})
|
||||
go func() {
|
||||
reconciler.Run(stopChan)
|
||||
close(stoppedChan)
|
||||
}()
|
||||
waitForMount(t, fakePlugin, generatedVolumeName, asw)
|
||||
// Stop the reconciler.
|
||||
close(stopChan)
|
||||
<-stoppedChan
|
||||
|
||||
finished := make(chan interface{})
|
||||
fakePlugin.UnmountDeviceHook = func(mountPath string) error {
|
||||
@ -1252,6 +1260,9 @@ func Test_Run_Positive_VolumeMountControllerAttachEnabledRace(t *testing.T) {
|
||||
return devicePath, nil
|
||||
}
|
||||
|
||||
// Start the reconciler again.
|
||||
go reconciler.Run(wait.NeverStop)
|
||||
|
||||
// 2. Delete the volume from DSW (and wait for callbacks)
|
||||
dsw.DeletePodFromVolume(podName, generatedVolumeName)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user