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

     1  package gcp
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/assert"
     7  )
     8  
     9  func TestCloudProviderConfig(t *testing.T) {
    10  	expectedConfig := `[global]
    11  project-id      = test-project-id
    12  regional        = true
    13  multizone       = true
    14  node-tags       = uid-master
    15  node-tags       = uid-control-plane
    16  node-tags       = uid-worker
    17  node-instance-prefix = uid
    18  external-instance-groups-prefix = uid
    19  subnetwork-name = uid-worker-subnet
    20  
    21  
    22  `
    23  	actualConfig, err := CloudProviderConfig("uid", "test-project-id", "uid-worker-subnet", "")
    24  	assert.NoError(t, err, "failed to create cloud provider config")
    25  	assert.Equal(t, expectedConfig, actualConfig, "unexpected cloud provider config")
    26  }
    27  
    28  func TestCloudProviderConfigWithNPID(t *testing.T) {
    29  	expectedConfig := `[global]
    30  project-id      = test-project-id
    31  regional        = true
    32  multizone       = true
    33  node-tags       = uid-master
    34  node-tags       = uid-control-plane
    35  node-tags       = uid-worker
    36  node-instance-prefix = uid
    37  external-instance-groups-prefix = uid
    38  subnetwork-name = uid-worker-subnet
    39  network-project-id = test-network-project-id
    40  
    41  `
    42  	actualConfig, err := CloudProviderConfig("uid", "test-project-id", "uid-worker-subnet", "test-network-project-id")
    43  	assert.NoError(t, err, "failed to create cloud provider config")
    44  	assert.Equal(t, expectedConfig, actualConfig, "unexpected cloud provider config")
    45  }