diff --git a/go.mod b/go.mod index efa03f81cdb..c1f776fcdc1 100644 --- a/go.mod +++ b/go.mod @@ -48,7 +48,7 @@ require ( knative.dev/hack v0.0.0-20231016131700-2c938d4918da knative.dev/hack/schema v0.0.0-20231016131700-2c938d4918da knative.dev/pkg v0.0.0-20231017113806-d6ab72900ea5 - knative.dev/reconciler-test v0.0.0-20231017131250-999d077826b7 + knative.dev/reconciler-test v0.0.0-20231023113936-e3a9c2e9b06b sigs.k8s.io/yaml v1.3.0 ) diff --git a/go.sum b/go.sum index c0ada3be71d..258d0a4d592 100644 --- a/go.sum +++ b/go.sum @@ -850,8 +850,8 @@ knative.dev/hack/schema v0.0.0-20231016131700-2c938d4918da h1:euBj0+2eY7BryoQe6a knative.dev/hack/schema v0.0.0-20231016131700-2c938d4918da/go.mod h1:3pWwBLnTZSM9psSgCAvhKOHIPTzqfEMlWRpDu6IYhK0= knative.dev/pkg v0.0.0-20231017113806-d6ab72900ea5 h1:9AvFZdEtuwKWDcTV1VSwmrgrRR9f38wbIAm+sNwLivQ= knative.dev/pkg v0.0.0-20231017113806-d6ab72900ea5/go.mod h1:HHRXEd7ZlFpthgE+rwAZ6MUVnuJOAeolnaFSthXloUQ= -knative.dev/reconciler-test v0.0.0-20231017131250-999d077826b7 h1:zcFdS5167SauAvKmmPPUmXJtUxlBdKUWmO/a+F67+IM= -knative.dev/reconciler-test v0.0.0-20231017131250-999d077826b7/go.mod h1:0jsKqMXLCIQNdceLuL2SL1LaAZSFtqUY7cLyHt0V2xY= +knative.dev/reconciler-test v0.0.0-20231023113936-e3a9c2e9b06b h1:L43rzmujsuHa2C1SdFdouBd5QBlibgiXIFyY/+luWnU= +knative.dev/reconciler-test v0.0.0-20231023113936-e3a9c2e9b06b/go.mod h1:0jsKqMXLCIQNdceLuL2SL1LaAZSFtqUY7cLyHt0V2xY= pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= diff --git a/vendor/knative.dev/reconciler-test/pkg/feature/feature.go b/vendor/knative.dev/reconciler-test/pkg/feature/feature.go index 1c4aef87383..4113bc3d0d4 100644 --- a/vendor/knative.dev/reconciler-test/pkg/feature/feature.go +++ b/vendor/knative.dev/reconciler-test/pkg/feature/feature.go @@ -227,6 +227,8 @@ func DeleteResources(ctx context.Context, t T, refs []corev1.ObjectReference) er } } + var lastResource corev1.ObjectReference // One still present resource + err := wait.Poll(time.Second, 4*time.Minute, func() (bool, error) { for _, ref := range refs { gv, err := schema.ParseGroupVersion(ref.APIVersion) @@ -248,6 +250,7 @@ func DeleteResources(ctx context.Context, t T, refs []corev1.ObjectReference) er return false, fmt.Errorf("failed to get resource %+v %s/%s: %w", resource, ref.Namespace, ref.Name, err) } + lastResource = ref t.Logf("Resource %+v %s/%s still present", resource, ref.Namespace, ref.Name) return false, nil } @@ -255,6 +258,7 @@ func DeleteResources(ctx context.Context, t T, refs []corev1.ObjectReference) er return true, nil }) if err != nil { + LogReferences(lastResource)(ctx, t) return fmt.Errorf("failed to wait for resources to be deleted: %v", err) } diff --git a/vendor/knative.dev/reconciler-test/pkg/feature/logging.go b/vendor/knative.dev/reconciler-test/pkg/feature/logging.go index cbbc572e069..2261e308868 100644 --- a/vendor/knative.dev/reconciler-test/pkg/feature/logging.go +++ b/vendor/knative.dev/reconciler-test/pkg/feature/logging.go @@ -26,6 +26,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime/schema" "knative.dev/pkg/apis" + kubeclient "knative.dev/pkg/client/injection/kube/client" "knative.dev/pkg/injection/clients/dynamicclient" ) @@ -62,13 +63,26 @@ func logReference(ref corev1.ObjectReference) StepFn { return } - b, err := json.MarshalIndent(r, "", " ") + b, err := json.MarshalIndent(r, "", " ") if err != nil { t.Logf("Failed to marshal %s: %v\n", resourceStr, err) return } - t.Logf("%s\n%s", resourceStr, string(b)) + // Get events for the given resource + events, _ := kubeclient.Get(ctx).EventsV1(). + Events(ref.Namespace). + List(ctx, metav1.ListOptions{ + TypeMeta: metav1.TypeMeta{ + Kind: ref.Kind, + APIVersion: ref.APIVersion, + }, + FieldSelector: fmt.Sprintf("involvedObject.name=%s", ref.Name), + Limit: 50, + }) + eBytes, _ := json.MarshalIndent(events, "", " ") + + t.Logf("%s\n%s\nEvents:\n%s\n", resourceStr, string(b), string(eBytes)) // Recursively log owners for _, or := range r.GetOwnerReferences() { diff --git a/vendor/modules.txt b/vendor/modules.txt index dd925064cf3..709df12e5cd 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1347,7 +1347,7 @@ knative.dev/pkg/webhook/resourcesemantics knative.dev/pkg/webhook/resourcesemantics/conversion knative.dev/pkg/webhook/resourcesemantics/defaulting knative.dev/pkg/webhook/resourcesemantics/validation -# knative.dev/reconciler-test v0.0.0-20231017131250-999d077826b7 +# knative.dev/reconciler-test v0.0.0-20231023113936-e3a9c2e9b06b ## explicit; go 1.20 knative.dev/reconciler-test/cmd/eventshub knative.dev/reconciler-test/pkg/environment