mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
Fix TestWebhookConverterWithWatchCache when ResilientWatchCacheInitialization and ConsistentListFromCache are enabled
This commit is contained in:
parent
7b359a2f9e
commit
3d3a73bd37
@ -683,6 +683,7 @@ func expectConversionFailureMessage(id, message string) func(t *testing.T, ctc *
|
||||
objv1beta2 := newConversionMultiVersionFixture(ns, id, "v1beta2")
|
||||
meta, _, _ := unstructured.NestedFieldCopy(obj.Object, "metadata")
|
||||
unstructured.SetNestedField(objv1beta2.Object, meta, "metadata")
|
||||
lastRV := objv1beta2.GetResourceVersion()
|
||||
|
||||
for _, verb := range []string{"get", "list", "create", "update", "patch", "delete", "deletecollection"} {
|
||||
t.Run(verb, func(t *testing.T) {
|
||||
@ -690,7 +691,10 @@ func expectConversionFailureMessage(id, message string) func(t *testing.T, ctc *
|
||||
case "get":
|
||||
_, err = clients["v1beta2"].Get(context.TODO(), obj.GetName(), metav1.GetOptions{})
|
||||
case "list":
|
||||
_, err = clients["v1beta2"].List(context.TODO(), metav1.ListOptions{})
|
||||
// With ResilientWatchcCacheInitialization feature, List requests are rejected with 429 if watchcache is not initialized.
|
||||
// However, in some of these tests that install faulty converter webhook, watchcache will never initialize by definition (as list will never succeed due to faulty converter webook).
|
||||
// In such case, the returned error will differ from the one returned from the etcd, so we need to force the request to go to etcd.
|
||||
_, err = clients["v1beta2"].List(context.TODO(), metav1.ListOptions{ResourceVersion: lastRV, ResourceVersionMatch: metav1.ResourceVersionMatchExact})
|
||||
case "create":
|
||||
_, err = clients["v1beta2"].Create(context.TODO(), newConversionMultiVersionFixture(ns, id, "v1beta2"), metav1.CreateOptions{})
|
||||
case "update":
|
||||
|
Loading…
Reference in New Issue
Block a user