Skip to content

Commit

Permalink
Add additional test for azuremachinetemplate webhook
Browse files Browse the repository at this point in the history
  • Loading branch information
dthorsen committed Jan 5, 2023
1 parent eabb34f commit d4afe92
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions api/v1beta1/azuremachinetemplate_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,56 @@ func TestAzureMachineTemplate_ValidateUpdate(t *testing.T) {
},
wantErr: false,
},
{
name: "AzureMachineTemplate with legacy AcceleratedNetworking updated to new networkInterfaces",
oldTemplate: &AzureMachineTemplate{
Spec: AzureMachineTemplateSpec{
Template: AzureMachineTemplateResource{
Spec: AzureMachineSpec{
VMSize: "size",
FailureDomain: &failureDomain,
OSDisk: OSDisk{
OSType: "type",
DiskSizeGB: to.Int32Ptr(11),
CachingType: "None",
},
DataDisks: []DataDisk{},
SSHPublicKey: "fake ssh key",
SubnetName: "",
AcceleratedNetworking: to.BoolPtr(true),
NetworkInterfaces: []NetworkInterface{},
},
},
},
},
template: &AzureMachineTemplate{
Spec: AzureMachineTemplateSpec{
Template: AzureMachineTemplateResource{
Spec: AzureMachineSpec{
VMSize: "size",
FailureDomain: &failureDomain,
OSDisk: OSDisk{
OSType: "type",
DiskSizeGB: to.Int32Ptr(11),
CachingType: "None",
},
DataDisks: []DataDisk{},
SSHPublicKey: "fake ssh key",
SubnetName: "",
AcceleratedNetworking: nil,
NetworkInterfaces: []NetworkInterface{
{
SubnetName: "",
AcceleratedNetworking: to.BoolPtr(true),
PrivateIPConfigs: 1,
},
},
},
},
},
},
wantErr: false,
},
{
name: "AzureMachineTemplate with modified networkInterfaces is immutable",
oldTemplate: &AzureMachineTemplate{
Expand Down

0 comments on commit d4afe92

Please sign in to comment.