From b4c2c9013e7645e79e856058d5c702703329bf63 Mon Sep 17 00:00:00 2001 From: Marek Schmidt Date: Tue, 17 Sep 2024 16:46:49 +0200 Subject: [PATCH] Assert EventTypes references for IMC test (#7899) (#868) * Assert EventTypes references for IMC and ContainerSource test * Do not use ID as the attribute to match the event The id is different for each event when using container source. Use just the type, like other tests for container source. * Fix type * Remove test for ContainerSource EventType creation It is not supported. Co-authored-by: Martin Gencur --- .../experimental/eventtype_autocreate_test.go | 14 -------- .../features/eventtype_autocreate/features.go | 33 ++----------------- 2 files changed, 2 insertions(+), 45 deletions(-) diff --git a/test/experimental/eventtype_autocreate_test.go b/test/experimental/eventtype_autocreate_test.go index 51f315d86d8..fab76eb66ff 100644 --- a/test/experimental/eventtype_autocreate_test.go +++ b/test/experimental/eventtype_autocreate_test.go @@ -102,17 +102,3 @@ func TestPingSourceEventTypeMatch(t *testing.T) { env.Test(ctx, t, eventtype_autocreate.AutoCreateEventTypeEventsFromPingSource()) } - -func TestContainerSourceEventTypeAutoCreate(t *testing.T) { - t.Parallel() - - ctx, env := global.Environment( - knative.WithKnativeNamespace(system.Namespace()), - knative.WithLoggingConfig, - knative.WithTracingConfig, - k8s.WithEventListener, - environment.Managed(t), - ) - - env.Test(ctx, t, eventtype_autocreate.AutoCreateEventTypesOnContainerSource()) -} diff --git a/test/experimental/features/eventtype_autocreate/features.go b/test/experimental/features/eventtype_autocreate/features.go index b46e5dd45e9..1c33d7abc70 100644 --- a/test/experimental/features/eventtype_autocreate/features.go +++ b/test/experimental/features/eventtype_autocreate/features.go @@ -29,7 +29,6 @@ import ( sourcesv1 "knative.dev/eventing/pkg/apis/sources/v1" "knative.dev/eventing/test/rekt/resources/broker" "knative.dev/eventing/test/rekt/resources/channel_impl" - "knative.dev/eventing/test/rekt/resources/containersource" "knative.dev/eventing/test/rekt/resources/eventtype" "knative.dev/eventing/test/rekt/resources/pingsource" "knative.dev/eventing/test/rekt/resources/subscription" @@ -68,7 +67,8 @@ func AutoCreateEventTypesOnIMC() *feature.Feature { Must("deliver events to subscriber", assert.OnStore(sink).MatchEvent(cetest.HasId(event.ID())).AtLeast(1)). Must("create event type", eventtype.WaitForEventType( eventtype.AssertReady(expectedTypes), - eventtype.AssertPresent(expectedTypes))) + eventtype.AssertPresent(expectedTypes), + eventtype.AssertReferencePresent(channel_impl.AsRef(channelName)))) return f } @@ -222,32 +222,3 @@ func AutoCreateEventTypeEventsFromPingSource() *feature.Feature { return f } - -func AutoCreateEventTypesOnContainerSource() *feature.Feature { - f := feature.NewFeature() - - event := cetest.FullEvent() - event.SetType("test.containersource.custom.event.type") - - sourceName := feature.MakeRandomK8sName("containersource") - sink := feature.MakeRandomK8sName("sink") - - f.Setup("install sink", eventshub.Install(sink, eventshub.StartReceiver)) - - destination := &duckv1.Destination{ - Ref: service.AsKReference(sink), - } - f.Setup("install containersource", containersource.Install(sourceName, containersource.WithSink(destination))) - - f.Setup("containersource is ready", containersource.IsReady(sourceName)) - - expectedTypes := sets.New(event.Type()) - - f.Stable("containersource"). - Must("delivers events to subscriber", assert.OnStore(sink).MatchEvent(cetest.HasId(event.ID())).AtLeast(1)). - Must("create event type", eventtype.WaitForEventType( - eventtype.AssertReady(expectedTypes), - eventtype.AssertExactPresent(expectedTypes))) - - return f -}