Move IsSecretKey into util/validation

This commit is contained in:
Tim Hockin
2016-04-28 20:34:48 -07:00
parent feea382960
commit 766f44f715
5 changed files with 65 additions and 27 deletions

View File

@@ -374,3 +374,31 @@ func TestIsValidPercent(t *testing.T) {
}
}
}
func TestIsConfigMapKey(t *testing.T) {
successCases := []string{
"good",
"good-good",
"still.good",
"this.is.also.good",
".so.is.this",
}
for i := range successCases {
if errs := IsConfigMapKey(successCases[i]); len(errs) != 0 {
t.Errorf("[%d] expected success: %v", i, errs)
}
}
failureCases := []string{
"bad_bad",
"..bad",
"bad.",
}
for i := range failureCases {
if errs := IsConfigMapKey(failureCases[i]); len(errs) == 0 {
t.Errorf("[%d] expected success", i)
}
}
}