Merge pull request #125825 from p0lyn0mial/upstream-apiextensions-deflake-integration-defaulting-test

apiextensions-apiserver/test/integration: deflake TestCustomResourceDefaultingWithoutWatchCache
This commit is contained in:
Kubernetes Prow Robot 2024-09-10 17:00:13 +01:00 committed by GitHub
commit 2ede639e57
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -376,8 +376,21 @@ func testDefaulting(t *testing.T, watchCache bool) {
if err != nil {
t.Fatal(err)
}
defer w.Stop()
select {
case event := <-w.ResultChan():
// since the RV we watch from can be compacted
// during the execution of the test,
// tolerate the expiration error.
//
// see: https://github.com/kubernetes/kubernetes/issues/125760
if event.Type == watch.Error {
if !apierrors.IsResourceExpired(apierrors.FromObject(event.Object)) {
t.Fatalf("unexpected watch event: %v, %#v", event.Type, event.Object)
}
t.Logf("skipping the WATCH at RV = %s, because the revision has been compacetd, err: %#v", initialResourceVersion, event.Object)
break
}
if event.Type != watch.Modified {
t.Fatalf("unexpected watch event: %v, %#v", event.Type, event.Object)
}