Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: trigger tests set annotations correctly now #7887

Merged
merged 3 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions test/rekt/features/trigger/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TriggerDependencyAnnotation() *feature.Feature {
f.Setup("broker is addressable", broker.IsAddressable(brokerName))

psourcename := "test-ping-source-annotation"
dependencyAnnotation := `{"kind":"PingSource","name":"test-ping-source-annotation","apiVersion":"sources.knative.dev/v1"}`
dependencyAnnotation := `'{"kind":"PingSource","name":"test-ping-source-annotation","apiVersion":"sources.knative.dev/v1"}'`
Cali0707 marked this conversation as resolved.
Show resolved Hide resolved
annotations := map[string]interface{}{
"knative.dev/dependency": dependencyAnnotation,
}
Expand All @@ -69,7 +69,8 @@ func TriggerDependencyAnnotation() *feature.Feature {
// Install the trigger
f.Setup("install trigger", trigger.Install(triggerName, brokerName, cfg...))

f.Setup("trigger goes ready", trigger.IsReady(triggerName))
// trigger won't go ready until after the pingsource exists, because of the dependency annotation
f.Requirement("trigger goes ready", trigger.IsReady(triggerName))

f.Requirement("install pingsource", func(ctx context.Context, t feature.T) {
brokeruri, err := broker.Address(ctx, brokerName)
Expand Down
12 changes: 4 additions & 8 deletions test/rekt/resources/trigger/trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,18 +124,14 @@ func WithSubscriberFromDestination(dest *duckv1.Destination) manifest.CfgFn {
// WithAnnotations adds annotations to the trigger
func WithAnnotations(annotations map[string]interface{}) manifest.CfgFn {
return func(cfg map[string]interface{}) {
if _, set := cfg["ceOverrides"]; !set {
cfg["ceOverrides"] = map[string]interface{}{}
if _, set := cfg["annotations"]; !set {
cfg["annotations"] = map[string]string{}
}
ceOverrides := cfg["ceOverrides"].(map[string]interface{})

if annotations != nil {
if _, set := ceOverrides["annotations"]; !set {
ceOverrides["annotations"] = map[string]interface{}{}
}
ceExt := ceOverrides["annotations"].(map[string]interface{})
annotation := cfg["annotations"].(map[string]string)
for k, v := range annotations {
ceExt[k] = v
annotation[k] = v.(string)
}
}
}
Expand Down
Loading