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

[release-1.14] fix: trigger tests set annotations correctly now #8053

Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion test/rekt/features/trigger/feature.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion test/rekt/resources/trigger/trigger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ metadata:
{{ if .annotations }}
annotations:
{{ range $key, $value := .annotations }}
{{ $key }}: {{ $value }}
{{ $key }}: '{{ $value }}'
{{ end }}
{{ end }}
spec:
Expand Down
Loading