@@ -142,8 +142,8 @@ func TestCloudConfigTransformer(t *testing.T) {
142142 infra : makeInfrastructureResource (configv1 .AzurePlatformType , configv1 .AzureStackCloud ),
143143 errMsg : fmt .Sprintf ("invalid platform, expected CloudName to be %s" , configv1 .AzurePublicCloud ),
144144 },
145- { // extend this to include Cloud so we don't duplicate
146- name : "Azure sets the vmType to standard" ,
145+ {
146+ name : "Azure sets the vmType to standard and cloud to AzurePublicCloud when neither is set " ,
147147 source : azure.Config {},
148148 expected : azure.Config {VMType : "standard" , AzureAuthConfig : ratelimitconfig.AzureAuthConfig {Cloud : string (configv1 .AzurePublicCloud )}},
149149 infra : makeInfrastructureResource (configv1 .AzurePlatformType , configv1 .AzurePublicCloud ),
@@ -154,18 +154,6 @@ func TestCloudConfigTransformer(t *testing.T) {
154154 expected : azure.Config {VMType : "vmss" , AzureAuthConfig : ratelimitconfig.AzureAuthConfig {Cloud : string (configv1 .AzurePublicCloud )}},
155155 infra : makeInfrastructureResource (configv1 .AzurePlatformType , configv1 .AzurePublicCloud ),
156156 },
157- {
158- name : "Azure sets the cloud to AzurePublicCloud" ,
159- source : azure.Config {},
160- expected : azure.Config {VMType : "standard" , AzureAuthConfig : ratelimitconfig.AzureAuthConfig {Cloud : string (configv1 .AzurePublicCloud )}},
161- infra : makeInfrastructureResource (configv1 .AzurePlatformType , configv1 .AzurePublicCloud ),
162- },
163- {
164- name : "Azure sets the cloud to AzurePublicCloud" ,
165- source : azure.Config {},
166- expected : azure.Config {VMType : "standard" , AzureAuthConfig : ratelimitconfig.AzureAuthConfig {Cloud : string (configv1 .AzurePublicCloud )}},
167- infra : makeInfrastructureResource (configv1 .AzurePlatformType , configv1 .AzurePublicCloud ),
168- },
169157 {
170158 name : "Azure sets the cloud to AzurePublicCloud and keeps existing fields" ,
171159 source : azure.Config {
@@ -198,15 +186,11 @@ func TestCloudConfigTransformer(t *testing.T) {
198186 expected : azure.Config {VMType : "standard" , AzureAuthConfig : ratelimitconfig.AzureAuthConfig {Cloud : string (configv1 .AzureGermanCloud )}},
199187 infra : makeInfrastructureResource (configv1 .AzurePlatformType , configv1 .AzureGermanCloud ),
200188 },
201- // The matcher should assert err.Error == errMsg - but is not for some
202- // reason? According to:
203- // https://onsi.github.io/gomega/#matcherrorexpected-interface the matcher
204- // asserts that ACTUAL.Error() == EXPECTED
205189 {
206190 name : "Azure throws an error if the infra has an invalid cloud" ,
207191 source : azure.Config {},
208192 infra : makeInfrastructureResource (configv1 .AzurePlatformType , "AzureAnotherCloud" ),
209- errMsg : "status.platformStatus.azure.cloudName: Unsupported value: \" AzureAnotherCloud\" : supported values: \" AzurePublicCloud \" , \" AzureUSGovernmentCloud \" , \" AzureChinaCloud \" , \" AzureGermanCloud \" , \" AzureStackCloud \" " ,
193+ errMsg : "status.platformStatus.azure.cloudName: Unsupported value: \" AzureAnotherCloud\" : supported values: \" AzureChinaCloud \" , \" AzureGermanCloud \" , \" AzurePublicCloud \" , \" AzureStackCloud \" , \" AzureUSGovernmentCloud \" " ,
210194 },
211195 {
212196 name : "Azure keeps the cloud set in the source when there is not one set in infrastructure" ,
@@ -249,8 +233,6 @@ func TestCloudConfigTransformer(t *testing.T) {
249233
250234 actual , err := CloudConfigTransformer (string (src ), tc .infra , nil )
251235 if tc .errMsg != "" {
252- // TODO: Remove once the above error case is working correctly
253- fmt .Printf ("\n \n err.Error():%s:\n \n " , err .Error ())
254236 g .Expect (err ).Should (MatchError (tc .errMsg ))
255237 g .Expect (actual ).Should (Equal ("" ))
256238 } else {
0 commit comments