mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #80880 from DirectXMan12/bug/length-is-measured-in-bytes
Validation: len is measured in bytes
This commit is contained in:
commit
1e94c12d41
@ -204,7 +204,7 @@ func Forbidden(field *Path, detail string) *Error {
|
||||
// Invalid, but the returned error will not include the too-long
|
||||
// value.
|
||||
func TooLong(field *Path, value interface{}, maxLength int) *Error {
|
||||
return &Error{ErrorTypeTooLong, field.String(), value, fmt.Sprintf("must have at most %d characters", maxLength)}
|
||||
return &Error{ErrorTypeTooLong, field.String(), value, fmt.Sprintf("must have at most %d bytes", maxLength)}
|
||||
}
|
||||
|
||||
// TooMany returns a *Error indicating "too many". This is used to
|
||||
|
@ -313,7 +313,7 @@ func TestObjectSizeResponses(t *testing.T) {
|
||||
expectedMsgFor1MB := `etcdserver: request is too large`
|
||||
expectedMsgFor2MB := `rpc error: code = ResourceExhausted desc = trying to send message larger than max`
|
||||
expectedMsgFor3MB := `Request entity too large: limit is 3145728`
|
||||
expectedMsgForLargeAnnotation := `metadata.annotations: Too long: must have at most 262144 characters`
|
||||
expectedMsgForLargeAnnotation := `metadata.annotations: Too long: must have at most 262144 bytes`
|
||||
|
||||
deployment1 := constructBody("a", DeploymentMegabyteSize, "labels", t) // >1 MB file
|
||||
deployment2 := constructBody("a", DeploymentTwoMegabyteSize, "labels", t) // >2 MB file
|
||||
|
Loading…
Reference in New Issue
Block a user