fix index test: multi index check for empty list

Signed-off-by: pacoxu <paco.xu@daocloud.io>

Kubernetes-commit: ae6360f6c732d554c332a0bc1b99808149d8376e
This commit is contained in:
pacoxu
2020-11-26 18:23:57 +08:00
committed by Kubernetes Publisher
parent 77dfe4dff7
commit 8031d76bd6

View File

@@ -76,7 +76,7 @@ func TestMultiIndexKeys(t *testing.T) {
expected["bert"] = sets.NewString("one", "two")
expected["elmo"] = sets.NewString("tre")
expected["oscar"] = sets.NewString("two")
expected["elmo"] = sets.NewString() // let's just make sure we don't get anything back in this case
expected["elmo1"] = sets.NewString()
{
for k, v := range expected {
found := sets.String{}
@@ -87,9 +87,8 @@ func TestMultiIndexKeys(t *testing.T) {
for _, item := range indexResults {
found.Insert(item.(*v1.Pod).Name)
}
items := v.List()
if !found.HasAll(items...) {
t.Errorf("missing items, index %s, expected %v but found %v", k, items, found.List())
if !found.Equal(v) {
t.Errorf("missing items, index %s, expected %v but found %v", k, v.List(), found.List())
}
}
}