Skip to content

Commit ab5bfe2

Browse files
Updates tests to return Azure PlatformStatus
This change stops the tests from segfaulting, as the new config transformer for Azure expects a PlatformStatus to be set.
1 parent d7cc0b9 commit ab5bfe2

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

pkg/cloud/azure/azure.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,11 @@ func NewProviderAssets(config config.OperatorConfig) (common.CloudProviderAssets
112112
}
113113

114114
func IsAzure(infra *configv1.Infrastructure) bool {
115-
if infra.Status.PlatformStatus != nil &&
116-
infra.Status.PlatformStatus.Type == configv1.AzurePlatformType &&
117-
infra.Status.PlatformStatus.Azure.CloudName != configv1.AzureStackCloud {
118-
return true
115+
if infra.Status.PlatformStatus != nil {
116+
if infra.Status.PlatformStatus.Type == configv1.AzurePlatformType &&
117+
(infra.Status.PlatformStatus.Azure.CloudName != configv1.AzureStackCloud) {
118+
return true
119+
}
119120
}
120121
return false
121122
}

pkg/controllers/cloud_config_sync_controller_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,20 @@ func makeNetworkResource() *configv1.Network {
5454
}
5555

5656
func makeInfraStatus(platform configv1.PlatformType) configv1.InfrastructureStatus {
57+
if platform == configv1.AzurePlatformType {
58+
return configv1.InfrastructureStatus{
59+
PlatformStatus: &configv1.PlatformStatus{
60+
Type: platform,
61+
Azure: &configv1.AzurePlatformStatus{
62+
CloudName: configv1.AzurePublicCloud,
63+
},
64+
},
65+
Platform: platform,
66+
InfrastructureTopology: configv1.HighlyAvailableTopologyMode,
67+
ControlPlaneTopology: configv1.HighlyAvailableTopologyMode,
68+
}
69+
}
70+
5771
return configv1.InfrastructureStatus{
5872
PlatformStatus: &configv1.PlatformStatus{
5973
Type: platform,

0 commit comments

Comments
 (0)