Skip to content

Commit

Permalink
Enable AuthZ e2e tests (#4087)
Browse files Browse the repository at this point in the history
* Enable AuthZ e2e test for KafkaSink

* Enable AuthZ e2e test for KafkaChannel

* Fix in Broker AuthZ test
  • Loading branch information
creydr authored Sep 2, 2024
1 parent ea0f055 commit 3511fe3
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 1 deletion.
1 change: 0 additions & 1 deletion test/e2e_new/broker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ func TestBrokerSupportsAuthZ(t *testing.T) {
knative.WithLoggingConfig,
knative.WithTracingConfig,
k8s.WithEventListener,
environment.WithPollTimings(4*time.Second, 12*time.Minute),
environment.Managed(t),
eventshub.WithTLS(t),
)
Expand Down
22 changes: 22 additions & 0 deletions test/e2e_new/sink_auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import (
"knative.dev/reconciler-test/pkg/feature"
"knative.dev/reconciler-test/pkg/k8s"
"knative.dev/reconciler-test/pkg/knative"

"knative.dev/eventing/test/rekt/features/authz"
)

func TestKafkaSinkSupportsOIDC(t *testing.T) {
Expand All @@ -56,3 +58,23 @@ func TestKafkaSinkSupportsOIDC(t *testing.T) {

env.TestSet(ctx, t, oidc.AddressableOIDCConformance(kafkasink.GVR(), "KafkaSink", sink, env.Namespace()))
}

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

ctx, env := global.Environment(
knative.WithKnativeNamespace(system.Namespace()),
knative.WithLoggingConfig,
knative.WithTracingConfig,
k8s.WithEventListener,
environment.Managed(t),
eventshub.WithTLS(t),
)

topic := feature.MakeRandomK8sName("topic")
sink := feature.MakeRandomK8sName("kafkasink")
env.Prerequisite(ctx, t, kafkatopic.GoesReady(topic))
env.Prerequisite(ctx, t, kafkasink.GoesReady(sink, topic, testpkg.BootstrapServersPlaintextArr))

env.TestSet(ctx, t, authz.AddressableAuthZConformance(kafkasink.GVR(), "KafkaSink", sink))
}
39 changes: 39 additions & 0 deletions test/e2e_new_channel/kafka_channel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ import (
"knative.dev/eventing-kafka-broker/test/rekt/features"
"knative.dev/eventing-kafka-broker/test/rekt/features/kafkachannel"
kafkachannelresource "knative.dev/eventing-kafka-broker/test/rekt/resources/kafkachannel"
channelresource "knative.dev/eventing/test/rekt/resources/channel"

"knative.dev/eventing/test/rekt/features/authz"
)

const (
Expand Down Expand Up @@ -111,6 +114,42 @@ func TestKafkaChannelOIDC(t *testing.T) {
env.TestSet(ctx, t, oidc.AddressableOIDCConformance(kafkachannelresource.GVR(), "KafkaChannel", name, env.Namespace()))
}

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

ctx, env := global.Environment(
knative.WithKnativeNamespace(system.Namespace()),
knative.WithLoggingConfig,
knative.WithTracingConfig,
k8s.WithEventListener,
environment.Managed(t),
eventshub.WithTLS(t),
)

name := feature.MakeRandomK8sName("channel")
env.Prerequisite(ctx, t, channel.GoesReady(name))

env.TestSet(ctx, t, authz.AddressableAuthZConformance(channelresource.GVR(), "Channel", name))
}

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

ctx, env := global.Environment(
knative.WithKnativeNamespace(system.Namespace()),
knative.WithLoggingConfig,
knative.WithTracingConfig,
k8s.WithEventListener,
environment.Managed(t),
eventshub.WithTLS(t),
)

name := feature.MakeRandomK8sName("kafkachannel")
env.Prerequisite(ctx, t, channel.ImplGoesReady(name))

env.TestSet(ctx, t, authz.AddressableAuthZConformance(kafkachannelresource.GVR(), "KafkaChannel", name))
}

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

Expand Down

0 comments on commit 3511fe3

Please sign in to comment.