@@ -1465,8 +1465,8 @@ func TestReconcile_PVCStorageClassResourceKey(t *testing.T) {
14651465 wantKey string
14661466 }{
14671467 {"unset falls back to default" , nil , "default.storageclass.storage.k8s.io/requests.storage" },
1468- {"empty falls back to default" , ptr . To ("" ), "default.storageclass.storage.k8s.io/requests.storage" },
1469- {"explicit class is kept" , ptr . To ("replicated" ), "replicated.storageclass.storage.k8s.io/requests.storage" },
1468+ {"empty falls back to default" , new (""), "default.storageclass.storage.k8s.io/requests.storage" },
1469+ {"explicit class is kept" , new ("replicated "), "replicated.storageclass.storage.k8s.io/requests.storage" },
14701470 }
14711471 for _ , tc := range cases {
14721472 t .Run (tc .name , func (t * testing.T ) {
@@ -1751,7 +1751,7 @@ func TestReconcile_PopulatedDataVolumeClearsTheLastVerdict(t *testing.T) {
17511751 ObjectMeta : metav1.ObjectMeta {Name : "vm-disk-test" , Namespace : "default" },
17521752 Spec : cozyv1alpha1.WorkloadMonitorSpec {Selector : selector , MinReplicas : ptr.To [int32 ](0 )},
17531753 Status : cozyv1alpha1.WorkloadMonitorStatus {
1754- Operational : ptr . To (false ),
1754+ Operational : new (false ),
17551755 Message : "DataVolume vm-disk-test is ImportInProgress" ,
17561756 Reason : cozyv1alpha1 .WorkloadMonitorReasonDataVolumeNotReady ,
17571757 },
@@ -1926,7 +1926,7 @@ func TestReconcile_UnreadDataVolumesKeepTheLastVerdict(t *testing.T) {
19261926 for _ , withReader := range []bool {true , false } {
19271927 t .Run (fmt .Sprintf ("reader=%v" , withReader ), func (t * testing.T ) {
19281928 got , _ , _ := reconcileWithUnreadableDataVolumes (t , withReader , false , cozyv1alpha1.WorkloadMonitorStatus {
1929- Operational : ptr . To (false ),
1929+ Operational : new (false ),
19301930 Message : stuck ,
19311931 Reason : cozyv1alpha1 .WorkloadMonitorReasonDataVolumeNotReady ,
19321932 })
@@ -1943,7 +1943,7 @@ func TestReconcile_UnreadDataVolumesKeepTheLastVerdict(t *testing.T) {
19431943func TestReconcile_SyncingDataVolumeWatchPublishesAndRequeues (t * testing.T ) {
19441944 const stuck = "DataVolume m is Failed"
19451945 got , result , events , err := reconcileWithUnreadableDataVolumesEvents (t , false , true , cozyv1alpha1.WorkloadMonitorStatus {
1946- Operational : ptr . To (false ),
1946+ Operational : new (false ),
19471947 Message : stuck ,
19481948 Reason : cozyv1alpha1 .WorkloadMonitorReasonDataVolumeNotReady ,
19491949 })
@@ -2136,7 +2136,7 @@ func TestTryStartDataVolumeWatch_UnsyncedSourceLeavesNoReaderAndRetries(t *testi
21362136 w := & startingWatcher {}
21372137 informers , fi := dataVolumeInformers (false )
21382138
2139- for attempt := 0 ; attempt < 3 ; attempt ++ {
2139+ for range 3 {
21402140 done , err := r .tryStartDataVolumeWatch (context .Background (), servedMapper (), w , informers , 50 * time .Millisecond )
21412141 if err == nil || done || readerOf (r ) != nil {
21422142 t .Fatalf ("informer never synced: done=%v err=%v reader=%v, want an error, not done, no reader" , done , err , readerOf (r ))
@@ -2213,15 +2213,15 @@ func TestTryStartDataVolumeWatch_StoredVerdictIsRecomputedOnceTheReaderIsInstall
22132213 MinReplicas : ptr.To [int32 ](0 ),
22142214 },
22152215 Status : cozyv1alpha1.WorkloadMonitorStatus {
2216- Operational : ptr . To (false ),
2216+ Operational : new (false ),
22172217 Message : "DataVolume stuck is ImportInProgress" ,
22182218 Reason : cozyv1alpha1 .WorkloadMonitorReasonDataVolumeNotReady ,
22192219 },
22202220 }
22212221 noVerdict := & cozyv1alpha1.WorkloadMonitor {
22222222 ObjectMeta : metav1.ObjectMeta {Name : "no-verdict" , Namespace : "default" },
22232223 Spec : cozyv1alpha1.WorkloadMonitorSpec {MinReplicas : ptr.To [int32 ](0 )},
2224- Status : cozyv1alpha1.WorkloadMonitorStatus {Operational : ptr . To (true )},
2224+ Status : cozyv1alpha1.WorkloadMonitorStatus {Operational : new (true )},
22252225 }
22262226 fakeClient := fake .NewClientBuilder ().WithScheme (s ).
22272227 WithObjects (stuck , noVerdict ).WithStatusSubresource (stuck , noVerdict ).Build ()
@@ -2316,14 +2316,14 @@ func TestTryStartDataVolumeWatch_FailedWatchLeavesNoReader(t *testing.T) {
23162316// While the DataVolume watch syncs, every monitor is requeued every few
23172317// seconds, so a pass that changes nothing must not write status.
23182318func TestReconcile_UnchangedStatusIsNotWritten (t * testing.T ) {
2319- settled := cozyv1alpha1.WorkloadMonitorStatus {Operational : ptr . To (true ), AvailableReplicas : 1 , ObservedReplicas : 1 }
2319+ settled := cozyv1alpha1.WorkloadMonitorStatus {Operational : new (true ), AvailableReplicas : 1 , ObservedReplicas : 1 }
23202320 for _ , tc := range []struct {
23212321 name string
23222322 status cozyv1alpha1.WorkloadMonitorStatus
23232323 writes int
23242324 }{
23252325 {"unchanged" , settled , 0 },
2326- {"changed" , cozyv1alpha1.WorkloadMonitorStatus {Operational : ptr . To (true )}, 1 },
2326+ {"changed" , cozyv1alpha1.WorkloadMonitorStatus {Operational : new (true )}, 1 },
23272327 } {
23282328 t .Run (tc .name , func (t * testing.T ) {
23292329 s := newTestScheme ()
@@ -2385,7 +2385,7 @@ func TestReconcile_PVCOfANotReadyDataVolumeIsNotOperational(t *testing.T) {
23852385 {name : "not owned by the DataVolume" , phase : "ImportInProgress" , reader : true , want : true },
23862386 {name : "controller of another kind" , phase : "ImportInProgress" , reader : true , controlled : true , ownerGVK : & schema.GroupVersionKind {Group : dataVolumeGVK .Group , Version : dataVolumeGVK .Version , Kind : "DataSource" }, want : true },
23872387 {name : "DataVolume kind of another group" , phase : "ImportInProgress" , reader : true , controlled : true , ownerGVK : & schema.GroupVersionKind {Group : "example.com" , Version : "v1" , Kind : dataVolumeGVK .Kind }, want : true },
2388- {name : "unread keeps the stored verdict" , phase : "Succeeded" , stored : ptr . To (false ), controlled : true , want : false },
2388+ {name : "unread keeps the stored verdict" , phase : "Succeeded" , stored : new (false ), controlled : true , want : false },
23892389 {name : "unread and new reads bind state" , phase : "ImportInProgress" , controlled : true , want : true },
23902390 } {
23912391 t .Run (tc .name , func (t * testing.T ) {
@@ -2398,7 +2398,7 @@ func TestReconcile_PVCOfANotReadyDataVolumeIsNotOperational(t *testing.T) {
23982398 dv .SetUID ("dv-uid" )
23992399 pvc := & corev1.PersistentVolumeClaim {
24002400 ObjectMeta : metav1.ObjectMeta {Name : "vm-disk-test" , Namespace : "default" , Labels : selector },
2401- Spec : corev1.PersistentVolumeClaimSpec {StorageClassName : ptr . To ("replicated" )},
2401+ Spec : corev1.PersistentVolumeClaimSpec {StorageClassName : new ("replicated ")},
24022402 Status : corev1.PersistentVolumeClaimStatus {Phase : corev1 .ClaimBound },
24032403 }
24042404 if tc .controlled {
0 commit comments