github.com/openshift/installer@v1.4.17/pkg/explain/fields_lookup_test.go (about) 1 package explain 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 ) 8 9 func Test_lookup(t *testing.T) { 10 schema, err := loadSchema(loadCRD(t)) 11 assert.NoError(t, err) 12 13 cases := []struct { 14 path []string 15 16 desc string 17 err string 18 }{{ 19 desc: `InstallConfig is the configuration for an OpenShift install.`, 20 }, { 21 path: []string{"publish"}, 22 desc: `Publish controls how the user facing endpoints of the cluster like the Kubernetes API, OpenShift routes etc. are exposed. When no strategy is specified, the strategy is "External".`, 23 }, { 24 path: []string{"publish", "unknown"}, 25 err: `invalid field unknown, no such property found`, 26 }, { 27 path: []string{"platform"}, 28 desc: `Platform is the configuration for the specific platform upon which to perform the installation.`, 29 }, { 30 path: []string{"platform", "aws"}, 31 desc: `AWS is the configuration used when installing on AWS.`, 32 }, { 33 path: []string{"platform", "azure"}, 34 desc: `Azure is the configuration used when installing on Azure.`, 35 }, { 36 path: []string{"platform", "aws", "region"}, 37 desc: `Region specifies the AWS region where the cluster will be created.`, 38 }, { 39 path: []string{"platform", "aws", "subnets"}, 40 desc: `Subnets specifies existing subnets (by ID) where cluster resources will be created. Leave unset to have the installer create subnets in a new VPC on your behalf.`, 41 }, { 42 path: []string{"platform", "aws", "userTags"}, 43 desc: `UserTags additional keys and values that the installer will add as tags to all resources that it creates. Resources created by the cluster itself may not include these tags.`, 44 }, { 45 path: []string{"platform", "aws", "serviceEndpoints"}, 46 desc: `ServiceEndpoints list contains custom endpoints which will override default service endpoint of AWS Services. There must be only one ServiceEndpoint for a service.`, 47 }, { 48 path: []string{"platform", "aws", "serviceEndpoints", "url"}, 49 desc: `URL is fully qualified URI with scheme https, that overrides the default generated endpoint for a client. This must be provided and cannot be empty.`, 50 }} 51 for _, test := range cases { 52 t.Run("", func(t *testing.T) { 53 got, err := lookup(schema, test.path) 54 if test.err == "" { 55 assert.NoError(t, err) 56 assert.Equal(t, test.desc, got.Description) 57 } else { 58 assert.Regexp(t, test.err, err) 59 } 60 }) 61 } 62 }