Skip to content

Commit 8e6114b

Browse files
committed
Update azure zone to non-pointer
1 parent 351e8fa commit 8e6114b

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

pkg/cloud/azure/actuators/machine/actuator_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -414,23 +414,23 @@ func TestAvailabilityZones(t *testing.T) {
414414
fakeScope := newFakeScope(t, actuators.ControlPlane)
415415
fakeReconciler := newFakeReconcilerWithScope(t, fakeScope)
416416

417-
fakeReconciler.scope.MachineConfig.Zone = to.StringPtr("2")
417+
fakeReconciler.scope.MachineConfig.Zone = "2"
418418
fakeReconciler.virtualMachinesSvc = &FakeVMCheckZonesService{
419419
checkZones: []string{"2"},
420420
}
421421
if err := fakeReconciler.Create(context.Background()); err != nil {
422422
t.Errorf("failed to create machine: %+v", err)
423423
}
424424

425-
fakeReconciler.scope.MachineConfig.Zone = nil
425+
fakeReconciler.scope.MachineConfig.Zone = ""
426426
fakeReconciler.virtualMachinesSvc = &FakeVMCheckZonesService{
427427
checkZones: []string{""},
428428
}
429429
if err := fakeReconciler.Create(context.Background()); err != nil {
430430
t.Errorf("failed to create machine: %+v", err)
431431
}
432432

433-
fakeReconciler.scope.MachineConfig.Zone = to.StringPtr("1")
433+
fakeReconciler.scope.MachineConfig.Zone = "1"
434434
fakeReconciler.virtualMachinesSvc = &FakeVMCheckZonesService{
435435
checkZones: []string{"3"},
436436
}
@@ -441,15 +441,15 @@ func TestAvailabilityZones(t *testing.T) {
441441

442442
func TestGetZone(t *testing.T) {
443443
testCases := []struct {
444-
inputZone *string
444+
inputZone string
445445
expected string
446446
}{
447447
{
448-
inputZone: nil,
448+
inputZone: "",
449449
expected: "",
450450
},
451451
{
452-
inputZone: pointer.StringPtr("3"),
452+
inputZone: "3",
453453
expected: "3",
454454
},
455455
}

pkg/cloud/azure/actuators/machine/reconciler.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727

2828
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-11-01/compute"
2929
"github.com/Azure/go-autorest/autorest"
30-
"github.com/Azure/go-autorest/autorest/to"
3130
machinev1 "github.com/openshift/api/machine/v1beta1"
3231
machinecontroller "github.com/openshift/machine-api-operator/pkg/controller/machine"
3332
"github.com/openshift/machine-api-operator/pkg/metrics"
@@ -547,7 +546,7 @@ func (s *Reconciler) Delete(ctx context.Context) error {
547546
}
548547

549548
func (s *Reconciler) getZone(ctx context.Context) (string, error) {
550-
return to.String(s.scope.MachineConfig.Zone), nil
549+
return s.scope.MachineConfig.Zone, nil
551550
}
552551

553552
func (s *Reconciler) createNetworkInterface(ctx context.Context, nicName string) error {

0 commit comments

Comments
 (0)