mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
Merge pull request #94676 from JornShen/fix_Test_Run_Positive_VolumeMountControllerAttachEnabledRace_data_trace
Fix flaky unit test Test_Run_Positive_VolumeMountControllerAttachEnabledRace data race
This commit is contained in:
commit
a9e9cabbea
@ -48,14 +48,14 @@ import (
|
||||
const (
|
||||
// reconcilerLoopSleepDuration is the amount of time the reconciler loop
|
||||
// waits between successive executions
|
||||
reconcilerLoopSleepDuration time.Duration = 1 * time.Nanosecond
|
||||
reconcilerLoopSleepDuration = 1 * time.Nanosecond
|
||||
// waitForAttachTimeout is the maximum amount of time a
|
||||
// operationexecutor.Mount call will wait for a volume to be attached.
|
||||
waitForAttachTimeout time.Duration = 1 * time.Second
|
||||
nodeName k8stypes.NodeName = k8stypes.NodeName("mynodename")
|
||||
kubeletPodsDir string = "fake-dir"
|
||||
testOperationBackOffDuration time.Duration = 100 * time.Millisecond
|
||||
reconcilerSyncWaitDuration time.Duration = 10 * time.Second
|
||||
waitForAttachTimeout = 1 * time.Second
|
||||
nodeName = k8stypes.NodeName("mynodename")
|
||||
kubeletPodsDir = "fake-dir"
|
||||
testOperationBackOffDuration = 100 * time.Millisecond
|
||||
reconcilerSyncWaitDuration = 10 * time.Second
|
||||
)
|
||||
|
||||
func hasAddedPods() bool { return true }
|
||||
@ -1791,6 +1791,7 @@ func Test_Run_Positive_VolumeMountControllerAttachEnabledRace(t *testing.T) {
|
||||
<-stoppedChan
|
||||
|
||||
finished := make(chan interface{})
|
||||
fakePlugin.Lock()
|
||||
fakePlugin.UnmountDeviceHook = func(mountPath string) error {
|
||||
// Act:
|
||||
// 3. While a volume is being unmounted, add it back to the desired state of world
|
||||
@ -1812,6 +1813,7 @@ func Test_Run_Positive_VolumeMountControllerAttachEnabledRace(t *testing.T) {
|
||||
close(finished)
|
||||
return devicePath, nil
|
||||
}
|
||||
fakePlugin.Unlock()
|
||||
|
||||
// Start the reconciler again.
|
||||
go reconciler.Run(wait.NeverStop)
|
||||
|
Loading…
Reference in New Issue
Block a user