Unverified Commit ca133695 authored by Kubernetes Prow Robot's avatar Kubernetes Prow Robot Committed by GitHub

Merge pull request #73404 from tsmetana/fix-kubelet-volume-test

Kubelet: Fix volumemanager test race
parents b4a02c35 45464f03
...@@ -1226,8 +1226,16 @@ func Test_Run_Positive_VolumeMountControllerAttachEnabledRace(t *testing.T) { ...@@ -1226,8 +1226,16 @@ func Test_Run_Positive_VolumeMountControllerAttachEnabledRace(t *testing.T) {
if err != nil { if err != nil {
t.Fatalf("AddPodToVolume failed. Expected: <no error> Actual: <%v>", err) 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) waitForMount(t, fakePlugin, generatedVolumeName, asw)
// Stop the reconciler.
close(stopChan)
<-stoppedChan
finished := make(chan interface{}) finished := make(chan interface{})
fakePlugin.UnmountDeviceHook = func(mountPath string) error { fakePlugin.UnmountDeviceHook = func(mountPath string) error {
...@@ -1252,6 +1260,9 @@ func Test_Run_Positive_VolumeMountControllerAttachEnabledRace(t *testing.T) { ...@@ -1252,6 +1260,9 @@ func Test_Run_Positive_VolumeMountControllerAttachEnabledRace(t *testing.T) {
return devicePath, nil return devicePath, nil
} }
// Start the reconciler again.
go reconciler.Run(wait.NeverStop)
// 2. Delete the volume from DSW (and wait for callbacks) // 2. Delete the volume from DSW (and wait for callbacks)
dsw.DeletePodFromVolume(podName, generatedVolumeName) dsw.DeletePodFromVolume(podName, generatedVolumeName)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment