diff --git a/test/experimental/eventtype_autocreate_test.go b/test/experimental/eventtype_autocreate_test.go index 52ed72876a1..4b6793b209a 100644 --- a/test/experimental/eventtype_autocreate_test.go +++ b/test/experimental/eventtype_autocreate_test.go @@ -20,6 +20,7 @@ import ( "testing" "knative.dev/eventing/test/experimental/features/eventtype_autocreate" + "knative.dev/eventing/test/rekt/resources/broker" "knative.dev/pkg/system" "knative.dev/reconciler-test/pkg/environment" @@ -54,7 +55,7 @@ func TestBrokerEventTypeAutoCreate(t *testing.T) { ) brokerName := feature.MakeRandomK8sName("broker") - env.Prerequisite(ctx, t, InstallMTBroker(brokerName)) + env.Prerequisite(ctx, t, broker.InstallMTBroker(brokerName)) env.Test(ctx, t, eventtype_autocreate.AutoCreateEventTypesOnBroker(brokerName)) } diff --git a/test/rekt/new_trigger_filters_test.go b/test/rekt/new_trigger_filters_test.go index 0319981ff1f..ce7db97fa5d 100644 --- a/test/rekt/new_trigger_filters_test.go +++ b/test/rekt/new_trigger_filters_test.go @@ -20,13 +20,11 @@ limitations under the License. package rekt import ( - "fmt" newfilters "knative.dev/eventing/test/rekt/features/new_trigger_filters" "testing" "knative.dev/pkg/system" "knative.dev/reconciler-test/pkg/environment" - "knative.dev/reconciler-test/pkg/feature" "knative.dev/reconciler-test/pkg/k8s" "knative.dev/reconciler-test/pkg/knative" @@ -45,7 +43,7 @@ func TestMTChannelBrokerNewTriggerFilters(t *testing.T) { ) brokerName := "default" - env.Prerequisite(ctx, t, InstallMTBroker(brokerName)) + env.Prerequisite(ctx, t, broker.InstallMTBroker(brokerName)) env.TestSet(ctx, t, newfilters.FiltersFeatureSet(brokerName)) } @@ -61,13 +59,6 @@ func TestMTChannelBrokerAnyTriggerFilters(t *testing.T) { ) brokerName := "default" - env.Prerequisite(ctx, t, InstallMTBroker(brokerName)) + env.Prerequisite(ctx, t, broker.InstallMTBroker(brokerName)) env.Test(ctx, t, newfilters.AnyFilterFeature(brokerName)) } - -func InstallMTBroker(name string) *feature.Feature { - f := feature.NewFeatureNamed("Multi-tenant channel-based broker") - f.Setup(fmt.Sprintf("Install broker %q", name), broker.Install(name, broker.WithEnvConfig()...)) - f.Requirement("Broker is ready", broker.IsReady(name)) - return f -} diff --git a/test/rekt/resources/broker/broker.go b/test/rekt/resources/broker/broker.go index e6d7f6cbde0..06dd93eb8fd 100644 --- a/test/rekt/resources/broker/broker.go +++ b/test/rekt/resources/broker/broker.go @@ -19,6 +19,7 @@ package broker import ( "context" "embed" + "fmt" "log" "os" "time" @@ -279,3 +280,10 @@ func AsKReference(name string) *duckv1.KReference { APIVersion: "eventing.knative.dev/v1", } } + +func InstallMTBroker(name string) *feature.Feature { + f := feature.NewFeatureNamed("Multi-tenant channel-based broker") + f.Setup(fmt.Sprintf("Install broker %q", name), Install(name, WithEnvConfig()...)) + f.Requirement("Broker is ready", IsReady(name)) + return f +}