mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 03:41:45 +00:00
Clean validation_test go file
When i wrote test cases for local storage quota, found some unused vars and useless code, remove them
This commit is contained in:
parent
5793be779b
commit
7589ef92c8
@ -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