Commit 7589ef92 authored by NickrenREN's avatar NickrenREN

Clean validation_test go file

When i wrote test cases for local storage quota, found some unused vars and useless code, remove them
parent 5793be77
...@@ -38,11 +38,6 @@ import ( ...@@ -38,11 +38,6 @@ import (
const ( const (
dnsLabelErrMsg = "a DNS-1123 label must consist of" dnsLabelErrMsg = "a DNS-1123 label must consist of"
dnsSubdomainLabelErrMsg = "a DNS-1123 subdomain" 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" envVarNameErrMsg = "a valid environment variable name must consist of"
) )
...@@ -9349,29 +9344,17 @@ func TestValidateBasicAuthSecret(t *testing.T) { ...@@ -9349,29 +9344,17 @@ func TestValidateBasicAuthSecret(t *testing.T) {
var ( var (
missingBasicAuthUsernamePasswordKeys = validBasicAuthSecret() missingBasicAuthUsernamePasswordKeys = validBasicAuthSecret()
// invalidBasicAuthUsernamePasswordKey = validBasicAuthSecret()
// emptyBasicAuthUsernameKey = validBasicAuthSecret()
// emptyBasicAuthPasswordKey = validBasicAuthSecret()
) )
delete(missingBasicAuthUsernamePasswordKeys.Data, api.BasicAuthUsernameKey) delete(missingBasicAuthUsernamePasswordKeys.Data, api.BasicAuthUsernameKey)
delete(missingBasicAuthUsernamePasswordKeys.Data, api.BasicAuthPasswordKey) 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 { tests := map[string]struct {
secret api.Secret secret api.Secret
valid bool valid bool
}{ }{
"valid": {validBasicAuthSecret(), true}, "valid": {validBasicAuthSecret(), true},
"missing username and password": {missingBasicAuthUsernamePasswordKeys, false}, "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 { for name, tc := range tests {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment