fix label selector parser in case no value (or only whitespaces) is specified after the key

This commit is contained in:
Chao Xu
2015-10-02 15:06:58 -07:00
parent 1d73382b83
commit 9be421c053
2 changed files with 11 additions and 2 deletions

View File

@@ -29,6 +29,10 @@ func TestSelectorParse(t *testing.T) {
"x=a,y=b,z=c",
"",
"x!=a,y=b",
"x=",
"x= ",
"x=,z= ",
"x= ,z= ",
}
testBadStrings := []string{
"x=a||y=b",
@@ -39,7 +43,7 @@ func TestSelectorParse(t *testing.T) {
if err != nil {
t.Errorf("%v: error %v (%#v)\n", test, err, err)
}
if test != lq.String() {
if strings.Replace(test, " ", "", -1) != lq.String() {
t.Errorf("%v restring gave: %v\n", test, lq.String())
}
}