@@ -19,7 +19,6 @@ package userwatermark
1919import (
2020 "context"
2121 "fmt"
22- "sync"
2322 "testing"
2423 "time"
2524
@@ -37,8 +36,6 @@ import (
3736 "github.com/kubewharf/katalyst-core/pkg/util/machine"
3837)
3938
40- var reclaimMutex = sync.Mutex {}
41-
4239func newTestDynamicConf () * dynamicconfig.DynamicAgentConfiguration {
4340 // NewDynamicAgentConfiguration already initializes a non-nil
4441 // UserWatermarkConfiguration via NewConfiguration().
@@ -208,8 +205,8 @@ func TestGetContainerCgroupPath_SuccessAndError(t *testing.T) {
208205
209206 t .Run ("success" , func (t * testing.T ) {
210207 t .Parallel ()
211- reclaimMutex .Lock ()
212- defer reclaimMutex .Unlock ()
208+ mockeyMutex .Lock ()
209+ defer mockeyMutex .Unlock ()
213210
214211 defer mockey .UnPatchAll ()
215212
@@ -223,8 +220,8 @@ func TestGetContainerCgroupPath_SuccessAndError(t *testing.T) {
223220
224221 t .Run ("error" , func (t * testing.T ) {
225222 t .Parallel ()
226- reclaimMutex .Lock ()
227- defer reclaimMutex .Unlock ()
223+ mockeyMutex .Lock ()
224+ defer mockeyMutex .Unlock ()
228225
229226 defer mockey .UnPatchAll ()
230227
@@ -242,8 +239,8 @@ func TestGetCGroupMemoryLimitAndUsage(t *testing.T) {
242239
243240 t .Run ("success" , func (t * testing.T ) {
244241 t .Parallel ()
245- reclaimMutex .Lock ()
246- defer reclaimMutex .Unlock ()
242+ mockeyMutex .Lock ()
243+ defer mockeyMutex .Unlock ()
247244
248245 defer mockey .UnPatchAll ()
249246
@@ -258,8 +255,8 @@ func TestGetCGroupMemoryLimitAndUsage(t *testing.T) {
258255
259256 t .Run ("error" , func (t * testing.T ) {
260257 t .Parallel ()
261- reclaimMutex .Lock ()
262- defer reclaimMutex .Unlock ()
258+ mockeyMutex .Lock ()
259+ defer mockeyMutex .Unlock ()
263260
264261 defer mockey .UnPatchAll ()
265262
@@ -273,8 +270,8 @@ func TestGetCGroupMemoryLimitAndUsage(t *testing.T) {
273270
274271 t .Run ("nilStats" , func (t * testing.T ) {
275272 t .Parallel ()
276- reclaimMutex .Lock ()
277- defer reclaimMutex .Unlock ()
273+ mockeyMutex .Lock ()
274+ defer mockeyMutex .Unlock ()
278275
279276 defer mockey .UnPatchAll ()
280277
@@ -292,8 +289,8 @@ func TestGetCGroupMemoryStats(t *testing.T) {
292289
293290 t .Run ("success" , func (t * testing.T ) {
294291 t .Parallel ()
295- reclaimMutex .Lock ()
296- defer reclaimMutex .Unlock ()
292+ mockeyMutex .Lock ()
293+ defer mockeyMutex .Unlock ()
297294
298295 defer mockey .UnPatchAll ()
299296
@@ -321,8 +318,8 @@ func TestGetCGroupMemoryStats(t *testing.T) {
321318
322319 t .Run ("error" , func (t * testing.T ) {
323320 t .Parallel ()
324- reclaimMutex .Lock ()
325- defer reclaimMutex .Unlock ()
321+ mockeyMutex .Lock ()
322+ defer mockeyMutex .Unlock ()
326323
327324 defer mockey .UnPatchAll ()
328325
@@ -350,12 +347,8 @@ func TestReachedHighWatermark(t *testing.T) {
350347
351348func TestUserWatermarkReclaimer_ReclaimSuccess (t * testing.T ) {
352349 t .Parallel ()
353- calculatorMutex .Lock ()
354- defer calculatorMutex .Unlock ()
355- managerMutex .Lock ()
356- defer managerMutex .Unlock ()
357- reclaimMutex .Lock ()
358- defer reclaimMutex .Unlock ()
350+ mockeyMutex .Lock ()
351+ defer mockeyMutex .Unlock ()
359352
360353 defer mockey .UnPatchAll ()
361354
@@ -430,8 +423,8 @@ func TestUserWatermarkReclaimer_ReclaimSuccess(t *testing.T) {
430423
431424func TestUserWatermarkReclaimer_ReclaimGetStatsFailed (t * testing.T ) {
432425 t .Parallel ()
433- reclaimMutex .Lock ()
434- defer reclaimMutex .Unlock ()
426+ mockeyMutex .Lock ()
427+ defer mockeyMutex .Unlock ()
435428
436429 defer mockey .UnPatchAll ()
437430
0 commit comments