Skip to content

Commit

Permalink
changed to two environments
Browse files Browse the repository at this point in the history
  • Loading branch information
yijie-04 committed May 23, 2024
1 parent 384d975 commit f8a08b0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
34 changes: 20 additions & 14 deletions test/rekt/crossnamespace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,33 +26,39 @@ import (
"knative.dev/reconciler-test/pkg/knative"

"knative.dev/eventing/test/rekt/features/broker"
cn "knative.dev/eventing/test/rekt/features/crossnamespace"
"knative.dev/eventing/test/rekt/features/featureflags"
"knative.dev/eventing/test/rekt/features/trigger"
)

func TestBrokerTriggerCrossNamespaceReference(t *testing.T) {
t.Parallel()

ctx, env := global.Environment(
// namespaces and names for the broker and trigger
brokerNamespace := feature.MakeRandomK8sName("broker-namespace")
triggerNamespace := feature.MakeRandomK8sName("trigger-namespace")
brokerName := feature.MakeRandomK8sName("broker")
triggerName := feature.MakeRandomK8sName("trigger")

brokerEnvCtx, brokerEnv := global.Environment(

Check failure on line 42 in test/rekt/crossnamespace_test.go

View workflow job for this annotation

GitHub Actions / test / Unit Tests

undefined: global
knative.WithKnativeNamespace(system.Namespace()),
knative.WithLoggingConfig,
knative.WithTracingConfig,
k8s.WithEventListener,
environment.Managed(t),
)

// namespaces and names for the broker and trigger
brokerNamespace := feature.MakeRandomK8sName("broker-namespace")
triggerNamespace := feature.MakeRandomK8sName("trigger-namespace")
brokerName := feature.MakeRandomK8sName("broker")
triggerName := feature.MakeRandomK8sName("trigger")
triggerEnvCtx, triggerEnv := global.Environment(

Check failure on line 50 in test/rekt/crossnamespace_test.go

View workflow job for this annotation

GitHub Actions / test / Unit Tests

undefined: global
knative.WithKnativeNamespace(system.Namespace()),
knative.WithLoggingConfig,
knative.WithTracingConfig,
k8s.WithEventListener,
environment.Managed(t),
)

env.Prerequisite("Cross Namespace Event Links is enabled", featureflags.CrossEventLinksEnabled())
// namespaces for the broker and trigger if they do not exist
env.Prerequisite(ctx, t, env.CreateNamespaceIfNeeded(brokerNamespace))
env.Prerequisite(ctx, t, env.CreateNamespaceIfNeeded(triggerNamespace))
triggerEnv.Prerequisite("Cross Namespace Event Links is enabled", featureflags.CrossEventLinksEnabled())

Check failure on line 58 in test/rekt/crossnamespace_test.go

View workflow job for this annotation

GitHub Actions / build / Build

not enough arguments in call to triggerEnv.Prerequisite

Check failure on line 58 in test/rekt/crossnamespace_test.go

View workflow job for this annotation

GitHub Actions / e2e tests (v1.28.7, ./test/rekt/...)

not enough arguments in call to triggerEnv.Prerequisite

Check failure on line 58 in test/rekt/crossnamespace_test.go

View workflow job for this annotation

GitHub Actions / e2e tests (v1.29.0, ./test/rekt/...)

not enough arguments in call to triggerEnv.Prerequisite
brokerEnv.Prerequisite("Cross Namespace Event Links is enabled", featureflags.CrossEventLinksEnabled())

Check failure on line 59 in test/rekt/crossnamespace_test.go

View workflow job for this annotation

GitHub Actions / build / Build

not enough arguments in call to brokerEnv.Prerequisite

Check failure on line 59 in test/rekt/crossnamespace_test.go

View workflow job for this annotation

GitHub Actions / e2e tests (v1.28.7, ./test/rekt/...)

not enough arguments in call to brokerEnv.Prerequisite

Check failure on line 59 in test/rekt/crossnamespace_test.go

View workflow job for this annotation

GitHub Actions / e2e tests (v1.29.0, ./test/rekt/...)

not enough arguments in call to brokerEnv.Prerequisite

env.Test(ctx, t, broker.GoesReadyInDifferentNamespace(brokerName, brokerNamespace))
env.Test(ctx, t, broker.TriggerGoesReady(triggerName, brokerName))
env.Test(ctx, t, cn.TriggerSendsEventsToBroker(brokerNamespace, brokerName, triggerNamespace, triggerName))
brokerEnv.Test(brokerEnvCtx, t, broker.GoesReadyInDifferentNamespace(brokerName, brokerNamespace))
brokerEnv.Test(brokerEnvCtx, t, broker.TriggerGoesReady(triggerName, brokerName))
triggerEnv.Test(triggerEnvCtx, t, trigger.CrossNamespaceEventLinks(brokerEnvCtx, brokerNamespace, brokerName, triggerNamespace, triggerName))
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package crossnamespace
package trigger

import (
"context"
Expand All @@ -30,7 +30,7 @@ import (
"knative.dev/eventing/test/rekt/resources/broker"
)

func TriggerSendsEventsToBroker(brokerNamespace, brokerName, triggerNamespace, triggerName string) *feature.Feature {
func CrossNamespaceEventLinks(ctx context.Context, brokerNamespace, brokerName, triggerNamespace, triggerName string) *feature.Feature {
f := feature.NewFeature()

sourceName := feature.MakeRandomK8sName("source")
Expand Down

0 comments on commit f8a08b0

Please sign in to comment.