Skip to content

Commit

Permalink
Add broker OIDC e2e tests (knative-extensions#3685)
Browse files Browse the repository at this point in the history
* Add broker OIDC e2e tests

* Fix broker template to allow TLS & OIDC configuration on dead letter sink
  • Loading branch information
creydr committed Mar 18, 2024
1 parent a46972c commit a7875e3
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
39 changes: 39 additions & 0 deletions test/e2e_new/broker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,16 @@ import (

"knative.dev/pkg/system"
"knative.dev/reconciler-test/pkg/environment"
"knative.dev/reconciler-test/pkg/eventshub"
"knative.dev/reconciler-test/pkg/feature"
"knative.dev/reconciler-test/pkg/k8s"
"knative.dev/reconciler-test/pkg/knative"

"knative.dev/eventing-kafka-broker/test/rekt/features"
"knative.dev/eventing/test/rekt/features/broker"
brokereventingfeatures "knative.dev/eventing/test/rekt/features/broker"
"knative.dev/eventing/test/rekt/features/oidc"
brokerresources "knative.dev/eventing/test/rekt/resources/broker"
)

const (
Expand Down Expand Up @@ -231,3 +236,37 @@ func TestNamespacedBrokerNamespaceDeletion(t *testing.T) {
env.Test(ctx, t, features.SetupNamespacedBroker(name))
env.Test(ctx, t, features.CleanupNamespace(namespace))
}

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

ctx, env := global.Environment(
knative.WithKnativeNamespace(system.Namespace()),
knative.WithLoggingConfig,
knative.WithTracingConfig,
k8s.WithEventListener,
environment.WithPollTimings(4*time.Second, 12*time.Minute),
environment.Managed(t),
eventshub.WithTLS(t),
)

name := feature.MakeRandomK8sName("broker")
env.Prerequisite(ctx, t, broker.GoesReady(name, brokerresources.WithEnvConfig()...))

env.TestSet(ctx, t, oidc.AddressableOIDCConformance(brokerresources.GVR(), "Broker", name, env.Namespace()))
}

func TestBrokerSendsEventsWithOIDCSupport(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),
)

env.TestSet(ctx, t, brokereventingfeatures.BrokerSendEventWithOIDC())
}
7 changes: 7 additions & 0 deletions test/e2e_new/templates/kafka-broker/broker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ spec:
{{ if .delivery.deadLetterSink.uri }}
uri: {{ .delivery.deadLetterSink.uri }}
{{ end }}
{{ if .delivery.deadLetterSink.CACerts }}
CACerts: |-
{{ .delivery.deadLetterSink.CACerts }}
{{ end }}
{{ if .delivery.deadLetterSink.audience }}
audience: {{ .delivery.deadLetterSink.audience }}
{{ end }}
{{ end }}
{{ if .delivery.retry }}
retry: {{ .delivery.retry}}
Expand Down

0 comments on commit a7875e3

Please sign in to comment.