@@ -1464,8 +1464,8 @@ func TestReconcile_PVCStorageClassResourceKey(t *testing.T) {
14641464 wantKey string
14651465 }{
14661466 {"unset falls back to default" , nil , "default.storageclass.storage.k8s.io/requests.storage" },
1467- {"empty falls back to default" , ptr . To ("" ), "default.storageclass.storage.k8s.io/requests.storage" },
1468- {"explicit class is kept" , ptr . To ("replicated" ), "replicated.storageclass.storage.k8s.io/requests.storage" },
1467+ {"empty falls back to default" , new (""), "default.storageclass.storage.k8s.io/requests.storage" },
1468+ {"explicit class is kept" , new ("replicated "), "replicated.storageclass.storage.k8s.io/requests.storage" },
14691469 }
14701470 for _ , tc := range cases {
14711471 t .Run (tc .name , func (t * testing.T ) {
@@ -1655,7 +1655,7 @@ func TestReconcile_PopulatedDataVolumeClearsTheLastVerdict(t *testing.T) {
16551655 ObjectMeta : metav1.ObjectMeta {Name : "vm-disk-test" , Namespace : "default" },
16561656 Spec : cozyv1alpha1.WorkloadMonitorSpec {Selector : selector , MinReplicas : ptr.To [int32 ](0 )},
16571657 Status : cozyv1alpha1.WorkloadMonitorStatus {
1658- Operational : ptr . To (false ),
1658+ Operational : new (false ),
16591659 Message : "DataVolume vm-disk-test is ImportInProgress" ,
16601660 Reason : cozyv1alpha1 .WorkloadMonitorReasonDataVolumeNotReady ,
16611661 },
@@ -1830,7 +1830,7 @@ func TestReconcile_UnreadDataVolumesKeepTheLastVerdict(t *testing.T) {
18301830 for _ , withReader := range []bool {true , false } {
18311831 t .Run (fmt .Sprintf ("reader=%v" , withReader ), func (t * testing.T ) {
18321832 got , _ , _ := reconcileWithUnreadableDataVolumes (t , withReader , false , cozyv1alpha1.WorkloadMonitorStatus {
1833- Operational : ptr . To (false ),
1833+ Operational : new (false ),
18341834 Message : stuck ,
18351835 Reason : cozyv1alpha1 .WorkloadMonitorReasonDataVolumeNotReady ,
18361836 })
@@ -1847,7 +1847,7 @@ func TestReconcile_UnreadDataVolumesKeepTheLastVerdict(t *testing.T) {
18471847func TestReconcile_SyncingDataVolumeWatchPublishesAndRequeues (t * testing.T ) {
18481848 const stuck = "DataVolume m is Failed"
18491849 got , result , events , err := reconcileWithUnreadableDataVolumesEvents (t , false , true , cozyv1alpha1.WorkloadMonitorStatus {
1850- Operational : ptr . To (false ),
1850+ Operational : new (false ),
18511851 Message : stuck ,
18521852 Reason : cozyv1alpha1 .WorkloadMonitorReasonDataVolumeNotReady ,
18531853 })
@@ -2040,7 +2040,7 @@ func TestTryStartDataVolumeWatch_UnsyncedSourceLeavesNoReaderAndRetries(t *testi
20402040 w := & startingWatcher {}
20412041 informers , fi := dataVolumeInformers (false )
20422042
2043- for attempt := 0 ; attempt < 3 ; attempt ++ {
2043+ for range 3 {
20442044 done , err := r .tryStartDataVolumeWatch (context .Background (), servedMapper (), w , informers , 50 * time .Millisecond )
20452045 if err == nil || done || readerOf (r ) != nil {
20462046 t .Fatalf ("informer never synced: done=%v err=%v reader=%v, want an error, not done, no reader" , done , err , readerOf (r ))
@@ -2117,15 +2117,15 @@ func TestTryStartDataVolumeWatch_StoredVerdictIsRecomputedOnceTheReaderIsInstall
21172117 MinReplicas : ptr.To [int32 ](0 ),
21182118 },
21192119 Status : cozyv1alpha1.WorkloadMonitorStatus {
2120- Operational : ptr . To (false ),
2120+ Operational : new (false ),
21212121 Message : "DataVolume stuck is ImportInProgress" ,
21222122 Reason : cozyv1alpha1 .WorkloadMonitorReasonDataVolumeNotReady ,
21232123 },
21242124 }
21252125 noVerdict := & cozyv1alpha1.WorkloadMonitor {
21262126 ObjectMeta : metav1.ObjectMeta {Name : "no-verdict" , Namespace : "default" },
21272127 Spec : cozyv1alpha1.WorkloadMonitorSpec {MinReplicas : ptr.To [int32 ](0 )},
2128- Status : cozyv1alpha1.WorkloadMonitorStatus {Operational : ptr . To (true )},
2128+ Status : cozyv1alpha1.WorkloadMonitorStatus {Operational : new (true )},
21292129 }
21302130 fakeClient := fake .NewClientBuilder ().WithScheme (s ).
21312131 WithObjects (stuck , noVerdict ).WithStatusSubresource (stuck , noVerdict ).Build ()
@@ -2220,14 +2220,14 @@ func TestTryStartDataVolumeWatch_FailedWatchLeavesNoReader(t *testing.T) {
22202220// While the DataVolume watch syncs, every monitor is requeued every few
22212221// seconds, so a pass that changes nothing must not write status.
22222222func TestReconcile_UnchangedStatusIsNotWritten (t * testing.T ) {
2223- settled := cozyv1alpha1.WorkloadMonitorStatus {Operational : ptr . To (true ), AvailableReplicas : 1 , ObservedReplicas : 1 }
2223+ settled := cozyv1alpha1.WorkloadMonitorStatus {Operational : new (true ), AvailableReplicas : 1 , ObservedReplicas : 1 }
22242224 for _ , tc := range []struct {
22252225 name string
22262226 status cozyv1alpha1.WorkloadMonitorStatus
22272227 writes int
22282228 }{
22292229 {"unchanged" , settled , 0 },
2230- {"changed" , cozyv1alpha1.WorkloadMonitorStatus {Operational : ptr . To (true )}, 1 },
2230+ {"changed" , cozyv1alpha1.WorkloadMonitorStatus {Operational : new (true )}, 1 },
22312231 } {
22322232 t .Run (tc .name , func (t * testing.T ) {
22332233 s := newTestScheme ()
@@ -2289,7 +2289,7 @@ func TestReconcile_PVCOfANotReadyDataVolumeIsNotOperational(t *testing.T) {
22892289 {name : "not owned by the DataVolume" , phase : "ImportInProgress" , reader : true , want : true },
22902290 {name : "controller of another kind" , phase : "ImportInProgress" , reader : true , controlled : true , ownerGVK : & schema.GroupVersionKind {Group : dataVolumeGVK .Group , Version : dataVolumeGVK .Version , Kind : "DataSource" }, want : true },
22912291 {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 },
2292- {name : "unread keeps the stored verdict" , phase : "Succeeded" , stored : ptr . To (false ), controlled : true , want : false },
2292+ {name : "unread keeps the stored verdict" , phase : "Succeeded" , stored : new (false ), controlled : true , want : false },
22932293 {name : "unread and new reads bind state" , phase : "ImportInProgress" , controlled : true , want : true },
22942294 } {
22952295 t .Run (tc .name , func (t * testing.T ) {
@@ -2302,7 +2302,7 @@ func TestReconcile_PVCOfANotReadyDataVolumeIsNotOperational(t *testing.T) {
23022302 dv .SetUID ("dv-uid" )
23032303 pvc := & corev1.PersistentVolumeClaim {
23042304 ObjectMeta : metav1.ObjectMeta {Name : "vm-disk-test" , Namespace : "default" , Labels : selector },
2305- Spec : corev1.PersistentVolumeClaimSpec {StorageClassName : ptr . To ("replicated" )},
2305+ Spec : corev1.PersistentVolumeClaimSpec {StorageClassName : new ("replicated ")},
23062306 Status : corev1.PersistentVolumeClaimStatus {Phase : corev1 .ClaimBound },
23072307 }
23082308 if tc .controlled {
0 commit comments