Fix TestWebhookConverterWithWatchCache when ResilientWatchCacheInitialization and ConsistentListFromCache are enabled
This commit is contained in:
		| @@ -683,6 +683,7 @@ func expectConversionFailureMessage(id, message string) func(t *testing.T, ctc * | |||||||
| 		objv1beta2 := newConversionMultiVersionFixture(ns, id, "v1beta2") | 		objv1beta2 := newConversionMultiVersionFixture(ns, id, "v1beta2") | ||||||
| 		meta, _, _ := unstructured.NestedFieldCopy(obj.Object, "metadata") | 		meta, _, _ := unstructured.NestedFieldCopy(obj.Object, "metadata") | ||||||
| 		unstructured.SetNestedField(objv1beta2.Object, meta, "metadata") | 		unstructured.SetNestedField(objv1beta2.Object, meta, "metadata") | ||||||
|  | 		lastRV := objv1beta2.GetResourceVersion() | ||||||
|  |  | ||||||
| 		for _, verb := range []string{"get", "list", "create", "update", "patch", "delete", "deletecollection"} { | 		for _, verb := range []string{"get", "list", "create", "update", "patch", "delete", "deletecollection"} { | ||||||
| 			t.Run(verb, func(t *testing.T) { | 			t.Run(verb, func(t *testing.T) { | ||||||
| @@ -690,7 +691,10 @@ func expectConversionFailureMessage(id, message string) func(t *testing.T, ctc * | |||||||
| 				case "get": | 				case "get": | ||||||
| 					_, err = clients["v1beta2"].Get(context.TODO(), obj.GetName(), metav1.GetOptions{}) | 					_, err = clients["v1beta2"].Get(context.TODO(), obj.GetName(), metav1.GetOptions{}) | ||||||
| 				case "list": | 				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": | 				case "create": | ||||||
| 					_, err = clients["v1beta2"].Create(context.TODO(), newConversionMultiVersionFixture(ns, id, "v1beta2"), metav1.CreateOptions{}) | 					_, err = clients["v1beta2"].Create(context.TODO(), newConversionMultiVersionFixture(ns, id, "v1beta2"), metav1.CreateOptions{}) | ||||||
| 				case "update": | 				case "update": | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Marek Siarkowicz
					Marek Siarkowicz