client-go/metadata/fake: expose IsWatchListSemanticsUnSupported

Kubernetes-commit: 8324fc3e0343e1c6134f3e83be2d77d9556a496c
This commit is contained in:
Lukasz Szaszkiewicz
2025-09-25 23:28:07 +02:00
committed by Kubernetes Publisher
parent c655edb878
commit cc2ef1778d
2 changed files with 12 additions and 0 deletions

View File

@@ -109,6 +109,10 @@ func (c *FakeMetadataClient) Resource(resource schema.GroupVersionResource) meta
return &metadataResourceClient{client: c, resource: resource}
}
func (c *FakeMetadataClient) IsWatchListSemanticsUnSupported() bool {
return true
}
// Namespace returns an interface for accessing the current resource in the specified
// namespace.
func (c *metadataResourceClient) Namespace(ns string) metadata.ResourceInterface {

View File

@@ -27,6 +27,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
"k8s.io/client-go/util/watchlist"
)
const (
@@ -58,6 +59,13 @@ func newPartialObjectMetadataWithAnnotations(annotations map[string]string) *met
return u
}
func TestDoesClientSupportWatchListSemantics(t *testing.T) {
target := &FakeMetadataClient{}
if !watchlist.DoesClientNotSupportWatchListSemantics(target) {
t.Fatalf("FakeMetadataClient should NOT support WatchList semantics")
}
}
func TestList(t *testing.T) {
scheme := NewTestScheme()
metav1.AddMetaToScheme(scheme)