Skip to content

Commit 4b1966c

Browse files
author
kfokina
committed
(velerostrategy_contoller_test) replace boolPtr helper with ptr.To()
Signed-off-by: kfokina <[email protected]>
1 parent b8faa73 commit 4b1966c

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

‎internal/backupcontroller/velerostrategy_controller.go‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,6 @@ func stringPtr(s string) *string {
7575
return &s
7676
}
7777

78-
// boolPtr returns a pointer to a bool value.
79-
func boolPtr(b bool) *bool {
80-
return &b
81-
}
82-
8378
// boolDefault returns the value of a *bool pointer, or the given default if nil.
8479
func boolDefault(p *bool, def bool) bool {
8580
if p != nil {

‎internal/backupcontroller/velerostrategy_controller_test.go‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
1212
"k8s.io/apimachinery/pkg/runtime"
1313
"k8s.io/apimachinery/pkg/runtime/schema"
14+
"k8s.io/utils/ptr"
1415
dynamicfake "k8s.io/client-go/dynamic/fake"
1516
"k8s.io/client-go/kubernetes/scheme"
1617
"k8s.io/client-go/tools/record"
@@ -454,7 +455,7 @@ func TestPrepareForRestore_KeepOriginalPVCFalse_SkipsRename(t *testing.T) {
454455

455456
// keepOriginalPVC = false → PVCs should NOT be renamed
456457
opts := RestoreOptions{
457-
KeepOriginalPVC: boolPtr(false),
458+
KeepOriginalPVC: ptr.To(false),
458459
}
459460

460461
reconciler := newTestRestoreJobReconciler(t, pvc, restoreJob, backup)
@@ -1042,7 +1043,7 @@ func TestCreateResourceModifiersConfigMap_Copy_NoOVN(t *testing.T) {
10421043

10431044
// Copy restore: keepOriginalIpAndMac=false, no OVN annotations on copy
10441045
opts := RestoreOptions{
1045-
KeepOriginalIpAndMac: boolPtr(false),
1046+
KeepOriginalIpAndMac: ptr.To(false),
10461047
}
10471048
ur := makeVMInstanceUR("10.0.0.5", "aa:bb:cc:dd:ee:ff", nil)
10481049
target := restoreTarget{Namespace: targetNS, AppName: "test-vm", AppKind: "VMInstance", IsCopy: true}
@@ -1172,7 +1173,7 @@ func TestCreateResourceModifiersConfigMap_Copy_UsesMergePatchForPVC(t *testing.T
11721173
restoreJob := makeTestRestoreJob(sourceNS, "rj-copy-merge")
11731174
backup := makeTestBackup(sourceNS, "test-vm", "VMInstance")
11741175

1175-
opts := RestoreOptions{KeepOriginalIpAndMac: boolPtr(false)}
1176+
opts := RestoreOptions{KeepOriginalIpAndMac: ptr.To(false)}
11761177
ur := makeVMInstanceUR("", "", nil)
11771178
target := restoreTarget{Namespace: targetNS, AppName: "test-vm", AppKind: "VMInstance", IsCopy: true}
11781179

0 commit comments

Comments
 (0)