mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 12:15:52 +00:00
Merge pull request #50300 from NickrenREN/validation-cleanup
Automatic merge from submit-queue (batch tested with PRs 50300, 50328, 50368, 50370, 50372) Clean validation_test go file When i wrote test cases for feature gate of local storage quota, found some unused vars and useless code, remove them **Release note**: ```release-note NONE ```
This commit is contained in:
commit
55de6e5184
@ -38,11 +38,6 @@ import (
|
||||
const (
|
||||
dnsLabelErrMsg = "a DNS-1123 label must consist of"
|
||||
dnsSubdomainLabelErrMsg = "a DNS-1123 subdomain"
|
||||
labelErrMsg = "a valid label must be an empty string or consist of"
|
||||
lowerCaseLabelErrMsg = "a valid label must consist of"
|
||||
maxLengthErrMsg = "must be no more than"
|
||||
namePartErrMsg = "name part must consist of"
|
||||
nameErrMsg = "a qualified name must consist of"
|
||||
envVarNameErrMsg = "a valid environment variable name must consist of"
|
||||
)
|
||||
|
||||
@ -9349,29 +9344,17 @@ func TestValidateBasicAuthSecret(t *testing.T) {
|
||||
|
||||
var (
|
||||
missingBasicAuthUsernamePasswordKeys = validBasicAuthSecret()
|
||||
// invalidBasicAuthUsernamePasswordKey = validBasicAuthSecret()
|
||||
// emptyBasicAuthUsernameKey = validBasicAuthSecret()
|
||||
// emptyBasicAuthPasswordKey = validBasicAuthSecret()
|
||||
)
|
||||
|
||||
delete(missingBasicAuthUsernamePasswordKeys.Data, api.BasicAuthUsernameKey)
|
||||
delete(missingBasicAuthUsernamePasswordKeys.Data, api.BasicAuthPasswordKey)
|
||||
|
||||
// invalidBasicAuthUsernamePasswordKey.Data[api.BasicAuthUsernameKey] = []byte("bad")
|
||||
// invalidBasicAuthUsernamePasswordKey.Data[api.BasicAuthPasswordKey] = []byte("bad")
|
||||
|
||||
// emptyBasicAuthUsernameKey.Data[api.BasicAuthUsernameKey] = []byte("")
|
||||
// emptyBasicAuthPasswordKey.Data[api.BasicAuthPasswordKey] = []byte("")
|
||||
|
||||
tests := map[string]struct {
|
||||
secret api.Secret
|
||||
valid bool
|
||||
}{
|
||||
"valid": {validBasicAuthSecret(), true},
|
||||
"missing username and password": {missingBasicAuthUsernamePasswordKeys, false},
|
||||
// "invalid username and password": {invalidBasicAuthUsernamePasswordKey, false},
|
||||
// "empty username": {emptyBasicAuthUsernameKey, false},
|
||||
// "empty password": {emptyBasicAuthPasswordKey, false},
|
||||
}
|
||||
|
||||
for name, tc := range tests {
|
||||
|
Loading…
Reference in New Issue
Block a user