@@ -38,6 +38,7 @@ import (
38
38
stats "k8s.io/kubernetes/pkg/kubelet/server/stats"
39
39
statstest "k8s.io/kubernetes/pkg/kubelet/server/stats/testing"
40
40
testingclock "k8s.io/utils/clock/testing"
41
+ "k8s.io/utils/ptr"
41
42
)
42
43
43
44
var zero time.Time
@@ -626,8 +627,8 @@ func TestGarbageCollectBelowLowThreshold(t *testing.T) {
626
627
627
628
// Expect 40% usage.
628
629
imageStats := & statsapi.FsStats {
629
- AvailableBytes : uint64Ptr ( 600 ),
630
- CapacityBytes : uint64Ptr ( 1000 ),
630
+ AvailableBytes : ptr . To ( uint64 ( 600 ) ),
631
+ CapacityBytes : ptr . To ( uint64 ( 1000 ) ),
631
632
}
632
633
mockStatsProvider .EXPECT ().ImageFsStats (mock .Anything ).Return (imageStats , imageStats , nil )
633
634
@@ -659,8 +660,8 @@ func TestGarbageCollectBelowSuccess(t *testing.T) {
659
660
660
661
// Expect 95% usage and most of it gets freed.
661
662
imageFs := & statsapi.FsStats {
662
- AvailableBytes : uint64Ptr ( 50 ),
663
- CapacityBytes : uint64Ptr ( 1000 ),
663
+ AvailableBytes : ptr . To ( uint64 ( 50 ) ),
664
+ CapacityBytes : ptr . To ( uint64 ( 1000 ) ),
664
665
}
665
666
mockStatsProvider .EXPECT ().ImageFsStats (mock .Anything ).Return (imageFs , imageFs , nil )
666
667
fakeRuntime .ImageList = []container.Image {
@@ -681,8 +682,8 @@ func TestGarbageCollectNotEnoughFreed(t *testing.T) {
681
682
682
683
// Expect 95% usage and little of it gets freed.
683
684
imageFs := & statsapi.FsStats {
684
- AvailableBytes : uint64Ptr ( 50 ),
685
- CapacityBytes : uint64Ptr ( 1000 ),
685
+ AvailableBytes : ptr . To ( uint64 ( 50 ) ),
686
+ CapacityBytes : ptr . To ( uint64 ( 1000 ) ),
686
687
}
687
688
mockStatsProvider .EXPECT ().ImageFsStats (mock .Anything ).Return (imageFs , imageFs , nil )
688
689
fakeRuntime .ImageList = []container.Image {
@@ -916,7 +917,3 @@ func TestValidateImageGCPolicy(t *testing.T) {
916
917
}
917
918
}
918
919
}
919
-
920
- func uint64Ptr (i uint64 ) * uint64 {
921
- return & i
922
- }
0 commit comments