Captialize "API" in this error message.

Signed-off-by: Matt Moyer <moyerm@vmware.com>
This commit is contained in:
Matt Moyer 2021-03-11 16:11:46 -06:00
parent a64786a728
commit c9ce067a0e
No known key found for this signature in database
GPG Key ID: EAE88AD172C5AE2D
6 changed files with 11 additions and 11 deletions

View File

@ -171,7 +171,7 @@ func runGetKubeconfig(ctx context.Context, out io.Writer, deps kubeconfigDeps, f
// Validate api group suffix and immediately return an error if it is invalid. // Validate api group suffix and immediately return an error if it is invalid.
if err := groupsuffix.Validate(flags.concierge.apiGroupSuffix); err != nil { if err := groupsuffix.Validate(flags.concierge.apiGroupSuffix); err != nil {
return fmt.Errorf("invalid api group suffix: %w", err) return fmt.Errorf("invalid API group suffix: %w", err)
} }
execConfig := clientcmdapi.ExecConfig{ execConfig := clientcmdapi.ExecConfig{

View File

@ -536,13 +536,13 @@ func TestGetKubeconfig(t *testing.T) {
`), `),
}, },
{ {
name: "invalid api group suffix", name: "invalid API group suffix",
args: []string{ args: []string{
"--concierge-api-group-suffix", ".starts.with.dot", "--concierge-api-group-suffix", ".starts.with.dot",
}, },
wantError: true, wantError: true,
wantStderr: here.Doc(` wantStderr: here.Doc(`
Error: invalid api group suffix: a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*') Error: invalid API group suffix: a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')
`), `),
}, },
{ {

View File

@ -125,7 +125,7 @@ func TestLoginOIDCCommand(t *testing.T) {
`), `),
}, },
{ {
name: "invalid api group suffix", name: "invalid API group suffix",
args: []string{ args: []string{
"--issuer", "test-issuer", "--issuer", "test-issuer",
"--enable-concierge", "--enable-concierge",
@ -136,7 +136,7 @@ func TestLoginOIDCCommand(t *testing.T) {
}, },
wantError: true, wantError: true,
wantStderr: here.Doc(` wantStderr: here.Doc(`
Error: invalid concierge parameters: invalid api group suffix: a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*') Error: invalid concierge parameters: invalid API group suffix: a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')
`), `),
}, },
{ {

View File

@ -131,7 +131,7 @@ func TestLoginStaticCommand(t *testing.T) {
`), `),
}, },
{ {
name: "invalid api group suffix", name: "invalid API group suffix",
args: []string{ args: []string{
"--token", "test-token", "--token", "test-token",
"--enable-concierge", "--enable-concierge",
@ -142,7 +142,7 @@ func TestLoginStaticCommand(t *testing.T) {
}, },
wantError: true, wantError: true,
wantStderr: here.Doc(` wantStderr: here.Doc(`
Error: invalid concierge parameters: invalid api group suffix: a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*') Error: invalid concierge parameters: invalid API group suffix: a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')
`), `),
}, },
{ {

View File

@ -109,7 +109,7 @@ func WithEndpoint(endpoint string) Option {
func WithAPIGroupSuffix(apiGroupSuffix string) Option { func WithAPIGroupSuffix(apiGroupSuffix string) Option {
return func(c *Client) error { return func(c *Client) error {
if err := groupsuffix.Validate(apiGroupSuffix); err != nil { if err := groupsuffix.Validate(apiGroupSuffix); err != nil {
return fmt.Errorf("invalid api group suffix: %w", err) return fmt.Errorf("invalid API group suffix: %w", err)
} }
c.apiGroupSuffix = apiGroupSuffix c.apiGroupSuffix = apiGroupSuffix
return nil return nil

View File

@ -111,16 +111,16 @@ func TestNew(t *testing.T) {
WithEndpoint("https://example.com"), WithEndpoint("https://example.com"),
WithAPIGroupSuffix(""), WithAPIGroupSuffix(""),
}, },
wantErr: "invalid api group suffix: [must contain '.', a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')]", wantErr: "invalid API group suffix: [must contain '.', a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')]",
}, },
{ {
name: "invalid api group suffix", name: "invalid API group suffix",
opts: []Option{ opts: []Option{
WithAuthenticator("jwt", "test-authenticator"), WithAuthenticator("jwt", "test-authenticator"),
WithEndpoint("https://example.com"), WithEndpoint("https://example.com"),
WithAPIGroupSuffix(".starts.with.dot"), WithAPIGroupSuffix(".starts.with.dot"),
}, },
wantErr: "invalid api group suffix: a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')", wantErr: "invalid API group suffix: a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')",
}, },
{ {
name: "valid", name: "valid",