Make IsValidLabelValue return error strings

This commit is contained in:
Tim Hockin
2015-12-15 22:27:13 -08:00
parent a0cc59f28a
commit 66d0d87829
11 changed files with 47 additions and 40 deletions

View File

@@ -257,8 +257,8 @@ func TestIsValidLabelValue(t *testing.T) {
"", // empty value
}
for i := range successCases {
if !IsValidLabelValue(successCases[i]) {
t.Errorf("case %s expected success", successCases[i])
if errs := IsValidLabelValue(successCases[i]); len(errs) != 0 {
t.Errorf("case %s expected success: %v", successCases[i], errs)
}
}
@@ -273,7 +273,7 @@ func TestIsValidLabelValue(t *testing.T) {
strings.Repeat("a", 64), // over the limit
}
for i := range errorCases {
if IsValidLabelValue(errorCases[i]) {
if errs := IsValidLabelValue(errorCases[i]); len(errs) == 0 {
t.Errorf("case[%d] expected failure", i)
}
}