mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-12-09 17:45:35 +00:00
Merge pull request #75993 from caesarxuchao/add-count
Adding RemainingItemCount to ListMeta
This commit is contained in:
@@ -26,7 +26,7 @@ import (
|
||||
"github.com/onsi/ginkgo"
|
||||
"github.com/onsi/gomega"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
@@ -88,6 +88,7 @@ var _ = SIGDescribe("Servers with support for API chunking", func() {
|
||||
lastRV = list.ResourceVersion
|
||||
}
|
||||
gomega.Expect(list.ResourceVersion).To(gomega.Equal(lastRV))
|
||||
gomega.Expect(int(list.RemainingItemCount) + len(list.Items) + found).To(gomega.BeNumerically("==", numberOfTotalResources))
|
||||
for _, item := range list.Items {
|
||||
gomega.Expect(item.Name).To(gomega.Equal(fmt.Sprintf("template-%04d", found)))
|
||||
found++
|
||||
@@ -120,6 +121,7 @@ var _ = SIGDescribe("Servers with support for API chunking", func() {
|
||||
gomega.Expect(err).ToNot(gomega.HaveOccurred(), "failed to list pod templates in namespace: %s, given limit: %d", ns, opts.Limit)
|
||||
firstToken := list.Continue
|
||||
firstRV := list.ResourceVersion
|
||||
gomega.Expect(int(list.RemainingItemCount) + len(list.Items)).To(gomega.BeNumerically("==", numberOfTotalResources))
|
||||
framework.Logf("Retrieved %d/%d results with rv %s and continue %s", len(list.Items), opts.Limit, list.ResourceVersion, firstToken)
|
||||
|
||||
ginkgo.By("retrieving the second page until the token expires")
|
||||
@@ -153,7 +155,8 @@ var _ = SIGDescribe("Servers with support for API chunking", func() {
|
||||
gomega.Expect(err).ToNot(gomega.HaveOccurred(), "failed to list pod templates in namespace: %s, given inconsistent continue token %s and limit: %d", ns, opts.Continue, opts.Limit)
|
||||
gomega.Expect(list.ResourceVersion).ToNot(gomega.Equal(firstRV))
|
||||
gomega.Expect(len(list.Items)).To(gomega.BeNumerically("==", opts.Limit))
|
||||
found := oneTenth
|
||||
found := int(oneTenth)
|
||||
gomega.Expect(int(list.RemainingItemCount) + len(list.Items) + found).To(gomega.BeNumerically("==", numberOfTotalResources))
|
||||
for _, item := range list.Items {
|
||||
gomega.Expect(item.Name).To(gomega.Equal(fmt.Sprintf("template-%04d", found)))
|
||||
found++
|
||||
@@ -165,6 +168,7 @@ var _ = SIGDescribe("Servers with support for API chunking", func() {
|
||||
for {
|
||||
list, err := client.List(opts)
|
||||
gomega.Expect(err).ToNot(gomega.HaveOccurred(), "failed to list pod templates in namespace: %s, given limit: %d", ns, opts.Limit)
|
||||
gomega.Expect(int(list.RemainingItemCount) + len(list.Items) + found).To(gomega.BeNumerically("==", numberOfTotalResources))
|
||||
framework.Logf("Retrieved %d/%d results with rv %s and continue %s", len(list.Items), opts.Limit, list.ResourceVersion, list.Continue)
|
||||
gomega.Expect(len(list.Items)).To(gomega.BeNumerically("<=", opts.Limit))
|
||||
gomega.Expect(list.ResourceVersion).To(gomega.Equal(lastRV))
|
||||
|
||||
Reference in New Issue
Block a user