Skip to content

Commit 6ae1173

Browse files
committed
added testing and mock file changes
1 parent ceeae05 commit 6ae1173

File tree

2 files changed

+5
-22
lines changed

2 files changed

+5
-22
lines changed

pkg/asset/installconfig/azure/validation_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,10 @@ func TestAzureInstallConfigValidation(t *testing.T) {
635635

636636
azureClient.EXPECT().CheckIfExistsStorageAccount(gomock.Any(), validBootDiagnosticsResourceGroup, validBootDiagnosticsStorageAccount, validRegion).Return(nil)
637637

638+
// ARO specific code
639+
azureClient.EXPECT().CheckIfARO(gomock.Any(), gomock.Not("valid-resource-group-with-resources-aro")).Return(false, nil).AnyTimes()
640+
azureClient.EXPECT().CheckIfARO(gomock.Any(), "valid-resource-group-with-resources-aro").Return(true, nil).AnyTimes()
641+
638642
for _, tc := range cases {
639643
t.Run(tc.name, func(t *testing.T) {
640644
editedInstallConfig := validInstallConfig()
@@ -698,10 +702,7 @@ func Test_validateResourceGroup(t *testing.T) {
698702
err: `^\Qplatform.azure.resourceGroupName: Invalid value: "valid-resource-group-conf-tags": resource group has conflicting tags kubernetes.io_cluster.test-cluster-12345\E$`,
699703
}, {
700704
groupName: "valid-resource-group-with-resources",
701-
// ARO provisions Azure resources before resolving the asset graph,
702-
// so there will always be resources in its resource group.
703-
wantSkip: (&azure.Platform{}).IsARO(),
704-
err: `^\Qplatform.azure.resourceGroupName: Invalid value: "valid-resource-group-with-resources": resource group must be empty but it has 3 resources like id1, id2 ...\E$`,
705+
err: `^\Qplatform.azure.resourceGroupName: Invalid value: "valid-resource-group-with-resources": resource group must be empty but it has 3 resources like id1, id2 ...\E$`,
705706
}}
706707

707708
mockCtrl := gomock.NewController(t)

pkg/types/azure/validation/platform_test.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -58,31 +58,13 @@ func TestValidatePlatform(t *testing.T) {
5858
},
5959
{
6060
name: "invalid baseDomainResourceGroupName",
61-
wantSkip: func(p *azure.Platform) bool {
62-
// This test case doesn't apply to ARO
63-
// so we want to skip it when run tests for ARO build
64-
return p.IsARO()
65-
},
6661
platform: func() *azure.Platform {
6762
p := validPlatform()
6863
p.BaseDomainResourceGroupName = ""
6964
return p
7065
}(),
7166
expected: `^test-path\.baseDomainResourceGroupName: Required value: baseDomainResourceGroupName is the resource group name where the azure dns zone is deployed$`,
7267
},
73-
{
74-
name: "do not require baseDomainResourceGroupName on ARO",
75-
wantSkip: func(p *azure.Platform) bool {
76-
// This is a ARO-specific test case
77-
// so want to skip when running non-ARO builds
78-
return !p.IsARO()
79-
},
80-
platform: func() *azure.Platform {
81-
p := validPlatform()
82-
p.BaseDomainResourceGroupName = ""
83-
return p
84-
}(),
85-
},
8668
{
8769
name: "minimal",
8870
platform: validPlatform(),

0 commit comments

Comments
 (0)