Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions pkg/cache/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1035,13 +1035,15 @@ func CacheTest(createCacheFunc func(config *rest.Config, opts cache.Options) (ca
Version: "v1",
Kind: "PodList",
})
Expect(namespacedCache.List(context.Background(), out)).To(Succeed())

By("verifying the returned pod is from the watched namespace")
Expect(out.Items).NotTo(BeEmpty())
Expect(out.Items).Should(HaveLen(2))
for _, item := range out.Items {
Expect(item.GetNamespace()).To(Equal(testNamespaceOne))
for range 2 {
Expect(namespacedCache.List(context.Background(), out)).To(Succeed())

By("verifying the returned pod is from the watched namespace")
Expect(out.Items).NotTo(BeEmpty())
Expect(out.Items).Should(HaveLen(2))
for _, item := range out.Items {
Expect(item.GetNamespace()).To(Equal(testNamespaceOne))
}
}
By("listing all nodes - should still be able to list a cluster-scoped resource")
nodeList := &unstructured.UnstructuredList{}
Expand Down
5 changes: 1 addition & 4 deletions pkg/cache/multi_namespace_cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,7 @@ func (c *multiNamespaceCache) List(ctx context.Context, list client.ObjectList,
return err
}

allItems, err := apimeta.ExtractList(list)
if err != nil {
return err
}
allItems := []runtime.Object{}

limitSet := listOpts.Limit > 0

Expand Down
Loading