Skip to content

Commit 106b1d0

Browse files
committed
Add test
Signed-off-by: Xuhui zhang <xuhui@juicedata.io>
1 parent e4550b5 commit 106b1d0

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

pkg/cache/cache_test.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,13 +1035,15 @@ func CacheTest(createCacheFunc func(config *rest.Config, opts cache.Options) (ca
10351035
Version: "v1",
10361036
Kind: "PodList",
10371037
})
1038-
Expect(namespacedCache.List(context.Background(), out)).To(Succeed())
1039-
1040-
By("verifying the returned pod is from the watched namespace")
1041-
Expect(out.Items).NotTo(BeEmpty())
1042-
Expect(out.Items).Should(HaveLen(2))
1043-
for _, item := range out.Items {
1044-
Expect(item.GetNamespace()).To(Equal(testNamespaceOne))
1038+
for range 2 {
1039+
Expect(namespacedCache.List(context.Background(), out)).To(Succeed())
1040+
1041+
By("verifying the returned pod is from the watched namespace")
1042+
Expect(out.Items).NotTo(BeEmpty())
1043+
Expect(out.Items).Should(HaveLen(2))
1044+
for _, item := range out.Items {
1045+
Expect(item.GetNamespace()).To(Equal(testNamespaceOne))
1046+
}
10451047
}
10461048
By("listing all nodes - should still be able to list a cluster-scoped resource")
10471049
nodeList := &unstructured.UnstructuredList{}

0 commit comments

Comments
 (0)