Skip to content

Commit 7974cf4

Browse files
committed
Add GetZoneByNodeName test for VM with no zones
1 parent 7572685 commit 7974cf4

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

pkg/provider/azure_standard_test.go

+16
Original file line numberDiff line numberDiff line change
@@ -1192,6 +1192,22 @@ func TestGetStandardVMZoneByNodeName(t *testing.T) {
11921192
},
11931193
expectedErrMsg: fmt.Errorf("failed to parse zone %q: strconv.Atoi: parsing %q: invalid syntax", []string{"a"}, "a"),
11941194
},
1195+
{
1196+
name: "GetZoneByNodeName should set failuredomain to 0 if no zones are found",
1197+
nodeName: "vm5",
1198+
vm: &armcompute.VirtualMachine{
1199+
Name: ptr.To("vm5"),
1200+
Location: ptr.To("HybridEnvironment"),
1201+
Zones: []*string{},
1202+
Properties: &armcompute.VirtualMachineProperties{
1203+
InstanceView: nil, // can be nil on Azure Stack
1204+
},
1205+
},
1206+
expectedZone: cloudprovider.Zone{
1207+
FailureDomain: "0",
1208+
Region: "hybridenvironment",
1209+
},
1210+
},
11951211
}
11961212
for _, test := range testcases {
11971213
mockVMClient := cloud.ComputeClientFactory.GetVirtualMachineClient().(*mock_virtualmachineclient.MockInterface)

0 commit comments

Comments
 (0)