@@ -333,6 +333,7 @@ func TestCreateAvailabilitySet(t *testing.T) {
333
333
availabilitySetsSvc func () * mock_azure.MockService
334
334
availabilityZonesSvc func () * mock_azure.MockService
335
335
inputASName string
336
+ spotVMOptions * machinev1.SpotVMOptions
336
337
}{
337
338
{
338
339
name : "Error when availability zones client fails" ,
@@ -414,6 +415,22 @@ func TestCreateAvailabilitySet(t *testing.T) {
414
415
return availabilitySetsSvc
415
416
},
416
417
},
418
+ {
419
+ name : "Skip availability set creation when using Spot instances" ,
420
+ availabilityZonesSvc : func () * mock_azure.MockService {
421
+ availabilityZonesSvc := mock_azure .NewMockService (mockCtrl )
422
+ availabilityZonesSvc .EXPECT ().Get (gomock .Any (), gomock .Any ()).Return ([]string {}, nil ).Times (1 )
423
+ return availabilityZonesSvc
424
+ },
425
+ availabilitySetsSvc : func () * mock_azure.MockService {
426
+ availabilitySetsSvc := mock_azure .NewMockService (mockCtrl )
427
+ availabilitySetsSvc .EXPECT ().CreateOrUpdate (gomock .Any (), gomock .Any ()).Return (nil ).Times (0 )
428
+ return availabilitySetsSvc
429
+ },
430
+ spotVMOptions : & machinev1.SpotVMOptions {
431
+ MaxPrice : resource .NewQuantity (- 1 , resource .DecimalSI ),
432
+ },
433
+ },
417
434
{
418
435
name : "Skip availability set creation when name was specified in provider spec" ,
419
436
labels : map [string ]string {},
@@ -486,6 +503,7 @@ func TestCreateAvailabilitySet(t *testing.T) {
486
503
MachineConfig : & machinev1.AzureMachineProviderSpec {
487
504
VMSize : "Standard_D2_v2" ,
488
505
AvailabilitySet : tc .inputASName ,
506
+ SpotVMOptions : tc .spotVMOptions ,
489
507
},
490
508
},
491
509
}
0 commit comments