Skip to content

Commit

Permalink
Assert EventTypes references for IMC test (knative#7899) (#868)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
maschmid and mgencur authored Sep 17, 2024
1 parent 607aceb commit b4c2c90
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 45 deletions.
14 changes: 0 additions & 14 deletions test/experimental/eventtype_autocreate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
33 changes: 2 additions & 31 deletions test/experimental/features/eventtype_autocreate/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}

0 comments on commit b4c2c90

Please sign in to comment.