mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
apiserver/pkg/apis/config/validation: Add invalidURLErrFmt
In go1.14, the following change to 'net/url' was made: "When parsing of a URL fails (for example by Parse or ParseRequestURI), the resulting Error message will now quote the unparsable URL. This provides clearer structure and consistency with other parsing errors." Here we add a new const, 'invalidURLErrFmt' to properly handle the now quoted string in validation_test.go. ref: https://golang.org/doc/go1.14#net/url Signed-off-by: Stephen Augustus <saugustus@vmware.com>
This commit is contained in:
parent
236ef23f46
commit
b0f17c2918
@ -31,6 +31,7 @@ const (
|
|||||||
keyLenErrFmt = "secret is not of the expected length, got %d, expected one of %v"
|
keyLenErrFmt = "secret is not of the expected length, got %d, expected one of %v"
|
||||||
unsupportedSchemeErrFmt = "unsupported scheme %q for KMS provider, only unix is supported"
|
unsupportedSchemeErrFmt = "unsupported scheme %q for KMS provider, only unix is supported"
|
||||||
atLeastOneRequiredErrFmt = "at least one %s is required"
|
atLeastOneRequiredErrFmt = "at least one %s is required"
|
||||||
|
invalidURLErrFmt = "invalid endpoint for kms provider, error: parse %s: net/url: invalid control character in URL"
|
||||||
mandatoryFieldErrFmt = "%s is a mandatory field for a %s"
|
mandatoryFieldErrFmt = "%s is a mandatory field for a %s"
|
||||||
base64EncodingErr = "secrets must be base64 encoded"
|
base64EncodingErr = "secrets must be base64 encoded"
|
||||||
zeroOrNegativeErrFmt = "%s should be a positive value"
|
zeroOrNegativeErrFmt = "%s should be a positive value"
|
||||||
|
@ -296,7 +296,7 @@ func TestKMSEndpoint(t *testing.T) {
|
|||||||
desc: "invalid url",
|
desc: "invalid url",
|
||||||
in: &config.KMSConfiguration{Endpoint: "unix:///foo\n.socket"},
|
in: &config.KMSConfiguration{Endpoint: "unix:///foo\n.socket"},
|
||||||
want: field.ErrorList{
|
want: field.ErrorList{
|
||||||
field.Invalid(endpointField, "unix:///foo\n.socket", "invalid endpoint for kms provider, error: parse unix:///foo\n.socket: net/url: invalid control character in URL"),
|
field.Invalid(endpointField, "unix:///foo\n.socket", fmt.Sprintf(invalidURLErrFmt, `"unix:///foo\n.socket"`)),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user