Skip to content

Commit

Permalink
refactor InstallMTBroker into broker resources
Browse files Browse the repository at this point in the history
Signed-off-by: Calum Murray <[email protected]>
  • Loading branch information
Cali0707 committed Sep 7, 2023
1 parent 3b626ca commit 66ce3b4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
3 changes: 2 additions & 1 deletion test/experimental/eventtype_autocreate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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))
}

Expand Down
13 changes: 2 additions & 11 deletions test/rekt/new_trigger_filters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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))
}

Expand All @@ -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
}
8 changes: 8 additions & 0 deletions test/rekt/resources/broker/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package broker
import (
"context"
"embed"
"fmt"
"log"
"os"
"time"
Expand Down Expand Up @@ -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
}

0 comments on commit 66ce3b4

Please sign in to comment.