Skip to content

Commit

Permalink
add test for default mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
shysank committed Oct 27, 2021
1 parent 4de6ecd commit aefd581
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
10 changes: 10 additions & 0 deletions api/v1beta1/azurecluster_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,16 @@ func TestAzureCluster_ValidateUpdate(t *testing.T) {
},
wantErr: true,
},
{
name: "azurecluster azureEnvironment default mismatch",
oldCluster: createValidCluster(),
cluster: func() *AzureCluster {
cluster := createValidCluster()
cluster.Spec.AzureEnvironment = "AzurePublicCloud"
return cluster
}(),
wantErr: false,
},
{
name: "control plane outbound lb is immutable",
oldCluster: &AzureCluster{
Expand Down
43 changes: 43 additions & 0 deletions api/v1beta1/azuremachinetemplate_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,49 @@ func TestAzureMachineTemplate_ValidateUpdate(t *testing.T) {
},
wantErr: false,
},
{
name: "AzureMachineTemplate with default mismatch",
oldTemplate: &AzureMachineTemplate{
Spec: AzureMachineTemplateSpec{
Template: AzureMachineTemplateResource{
Spec: AzureMachineSpec{
VMSize: "size",
FailureDomain: &failureDomain,
OSDisk: OSDisk{
OSType: "type",
DiskSizeGB: to.Int32Ptr(11),
CachingType: "",
},
DataDisks: []DataDisk{},
SSHPublicKey: "",
},
},
},
ObjectMeta: metav1.ObjectMeta{
Name: "OldTemplate",
},
},
template: &AzureMachineTemplate{
Spec: AzureMachineTemplateSpec{
Template: AzureMachineTemplateResource{
Spec: AzureMachineSpec{
VMSize: "size",
FailureDomain: &failureDomain,
OSDisk: OSDisk{
OSType: "type",
DiskSizeGB: to.Int32Ptr(11),
CachingType: "None",
},
DataDisks: []DataDisk{},
},
},
},
ObjectMeta: metav1.ObjectMeta{
Name: "NewTemplate",
},
},
wantErr: false,
},
}

for _, amt := range tests {
Expand Down

0 comments on commit aefd581

Please sign in to comment.