github.com/openshift/installer@v1.4.17/pkg/asset/manifests/azure/cloudproviderconfig_test.go (about)

     1  package azure
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  
     8  	"github.com/openshift/installer/pkg/types/azure"
     9  )
    10  
    11  func TestCloudProviderConfig(t *testing.T) {
    12  
    13  	config := CloudProviderConfig{
    14  		CloudName:                azure.PublicCloud,
    15  		ResourceGroupName:        "clusterid-rg",
    16  		GroupLocation:            "westeurope",
    17  		ResourcePrefix:           "clusterid",
    18  		SubscriptionID:           "subID",
    19  		TenantID:                 "tenantID",
    20  		NetworkResourceGroupName: "clusterid-rg",
    21  		NetworkSecurityGroupName: "clusterid-node-nsg",
    22  		VirtualNetworkName:       "clusterid-vnet",
    23  		SubnetName:               "clusterid-worker-subnet",
    24  	}
    25  	expected := `{
    26  	"cloud": "AzurePublicCloud",
    27  	"tenantId": "tenantID",
    28  	"aadClientId": "",
    29  	"aadClientSecret": "",
    30  	"aadClientCertPath": "",
    31  	"aadClientCertPassword": "",
    32  	"useManagedIdentityExtension": true,
    33  	"userAssignedIdentityID": "",
    34  	"subscriptionId": "subID",
    35  	"resourceGroup": "clusterid-rg",
    36  	"location": "westeurope",
    37  	"vnetName": "clusterid-vnet",
    38  	"vnetResourceGroup": "clusterid-rg",
    39  	"subnetName": "clusterid-worker-subnet",
    40  	"securityGroupName": "clusterid-node-nsg",
    41  	"routeTableName": "clusterid-node-routetable",
    42  	"vmType": "standard",
    43  	"loadBalancerSku": "standard",
    44  	"cloudProviderBackoff": true,
    45  	"useInstanceMetadata": true,
    46  	"excludeMasterFromStandardLB": false,
    47  	"cloudProviderBackoffDuration": 6,
    48  	"putVMSSVMBatchSize": 0,
    49  	"enableMigrateToIPBasedBackendPoolAPI": false
    50  }
    51  `
    52  
    53  	json, err := config.JSON()
    54  	assert.NoError(t, err, "failed to create cloud provider config")
    55  	assert.Equal(t, expected, json, "unexpected cloud provider config")
    56  }