mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 01:40:07 +00:00
close channel to prevent memory leak
- wait.JitterUntil goroutine is never cleaned up when used with wait.NeverStop - fixup comment
This commit is contained in:
parent
c0579af684
commit
69719167a3
@ -55,7 +55,9 @@ func Test_Run_Positive_DoNothing(t *testing.T) {
|
|||||||
reconcilerLoopPeriod, maxWaitForUnmountDuration, dsw, asw, ad, nsu)
|
reconcilerLoopPeriod, maxWaitForUnmountDuration, dsw, asw, ad, nsu)
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
go reconciler.Run(wait.NeverStop)
|
ch := make(chan struct{})
|
||||||
|
go reconciler.Run(ch)
|
||||||
|
defer close(ch)
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
waitForNewAttacherCallCount(t, 0 /* expectedCallCount */, fakePlugin)
|
waitForNewAttacherCallCount(t, 0 /* expectedCallCount */, fakePlugin)
|
||||||
@ -97,7 +99,9 @@ func Test_Run_Positive_OneDesiredVolumeAttach(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
go reconciler.Run(wait.NeverStop)
|
ch := make(chan struct{})
|
||||||
|
go reconciler.Run(ch)
|
||||||
|
defer close(ch)
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
waitForNewAttacherCallCount(t, 1 /* expectedCallCount */, fakePlugin)
|
waitForNewAttacherCallCount(t, 1 /* expectedCallCount */, fakePlugin)
|
||||||
@ -140,7 +144,9 @@ func Test_Run_Positive_OneDesiredVolumeAttachThenDetachWithUnmountedVolume(t *te
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
go reconciler.Run(wait.NeverStop)
|
ch := make(chan struct{})
|
||||||
|
go reconciler.Run(ch)
|
||||||
|
defer close(ch)
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
waitForNewAttacherCallCount(t, 1 /* expectedCallCount */, fakePlugin)
|
waitForNewAttacherCallCount(t, 1 /* expectedCallCount */, fakePlugin)
|
||||||
@ -204,7 +210,9 @@ func Test_Run_Positive_OneDesiredVolumeAttachThenDetachWithMountedVolume(t *test
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
go reconciler.Run(wait.NeverStop)
|
ch := make(chan struct{})
|
||||||
|
go reconciler.Run(ch)
|
||||||
|
defer close(ch)
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
waitForNewAttacherCallCount(t, 1 /* expectedCallCount */, fakePlugin)
|
waitForNewAttacherCallCount(t, 1 /* expectedCallCount */, fakePlugin)
|
||||||
|
Loading…
Reference in New Issue
Block a user