mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-07-20 16:19:33 +00:00
Merge pull request #135000 from p0lyn0mial/upstream-watchlist-unsupported-wl-semantics-trackers
k8s.io/client-go/testing/fixture: does not support WatchList semantics
This commit is contained in:
@@ -511,6 +511,17 @@ func (t *tracker) Apply(gvr schema.GroupVersionResource, applyConfiguration runt
|
||||
return t.add(gvr, obj, ns, true)
|
||||
}
|
||||
|
||||
// IsWatchListSemanticsUnSupported informs the reflector that this client
|
||||
// doesn't support WatchList semantics.
|
||||
//
|
||||
// This is a synthetic method whose sole purpose is to satisfy the optional
|
||||
// interface check performed by the reflector.
|
||||
// Returning true signals that WatchList can NOT be used.
|
||||
// No additional logic is implemented here.
|
||||
func (t *tracker) IsWatchListSemanticsUnSupported() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (t *tracker) getWatches(gvr schema.GroupVersionResource, ns string) []*watch.RaceFreeFakeWatcher {
|
||||
watches := []*watch.RaceFreeFakeWatcher{}
|
||||
if t.watchers[gvr] != nil {
|
||||
|
||||
@@ -39,6 +39,7 @@ import (
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/managedfields"
|
||||
"k8s.io/apimachinery/pkg/watch"
|
||||
"k8s.io/client-go/util/watchlist"
|
||||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
@@ -740,3 +741,14 @@ func TestManagedFielsdObjectTrackerWithUnstructured(t *testing.T) {
|
||||
unstructured.RemoveNestedField(cmActual.Object, "metadata", "managedFields")
|
||||
require.Empty(t, cmp.Diff(cmOriginal, cmActual))
|
||||
}
|
||||
|
||||
func TestDoesClientSupportWatchListSemantics(t *testing.T) {
|
||||
scheme := runtime.NewScheme()
|
||||
codecs := serializer.NewCodecFactory(scheme)
|
||||
|
||||
target := NewObjectTracker(scheme, codecs.UniversalDecoder())
|
||||
|
||||
if !watchlist.DoesClientNotSupportWatchListSemantics(target) {
|
||||
t.Fatalf("ObjectTracker should NOT support WatchList semantics")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user