@@ -1411,6 +1411,65 @@ func TestMachineScope_AvailabilitySet(t *testing.T) {
1411
1411
wantAvailabilitySetName : "" ,
1412
1412
wantAvailabilitySetExistence : false ,
1413
1413
},
1414
+ {
1415
+ name : "returns empty and false if machine has failureDomain set" ,
1416
+ machineScope : MachineScope {
1417
+ ClusterScoper : & ClusterScope {
1418
+ Cluster : & clusterv1.Cluster {
1419
+ ObjectMeta : metav1.ObjectMeta {
1420
+ Name : "cluster" ,
1421
+ },
1422
+ },
1423
+ AzureCluster : & infrav1.AzureCluster {
1424
+ Status : infrav1.AzureClusterStatus {},
1425
+ },
1426
+ },
1427
+ Machine : & clusterv1.Machine {
1428
+ ObjectMeta : metav1.ObjectMeta {
1429
+ Labels : map [string ]string {
1430
+ clusterv1 .MachineDeploymentNameLabel : "foo-machine-deployment" ,
1431
+ },
1432
+ },
1433
+ Spec : clusterv1.MachineSpec {
1434
+ FailureDomain : ptr .To ("1" ),
1435
+ },
1436
+ },
1437
+ AzureMachine : & infrav1.AzureMachine {
1438
+ Spec : infrav1.AzureMachineSpec {},
1439
+ },
1440
+ },
1441
+ wantAvailabilitySetName : "" ,
1442
+ wantAvailabilitySetExistence : false ,
1443
+ },
1444
+ {
1445
+ name : "returns empty and false if azureMachine has failureDomain set" ,
1446
+ machineScope : MachineScope {
1447
+ ClusterScoper : & ClusterScope {
1448
+ Cluster : & clusterv1.Cluster {
1449
+ ObjectMeta : metav1.ObjectMeta {
1450
+ Name : "cluster" ,
1451
+ },
1452
+ },
1453
+ AzureCluster : & infrav1.AzureCluster {
1454
+ Status : infrav1.AzureClusterStatus {},
1455
+ },
1456
+ },
1457
+ Machine : & clusterv1.Machine {
1458
+ ObjectMeta : metav1.ObjectMeta {
1459
+ Labels : map [string ]string {
1460
+ clusterv1 .MachineDeploymentNameLabel : "foo-machine-deployment" ,
1461
+ },
1462
+ },
1463
+ },
1464
+ AzureMachine : & infrav1.AzureMachine {
1465
+ Spec : infrav1.AzureMachineSpec {
1466
+ FailureDomain : ptr .To ("1" ),
1467
+ },
1468
+ },
1469
+ },
1470
+ wantAvailabilitySetName : "" ,
1471
+ wantAvailabilitySetExistence : false ,
1472
+ },
1414
1473
}
1415
1474
for _ , tt := range tests {
1416
1475
t .Run (tt .name , func (t * testing.T ) {
0 commit comments