Skip to content

Commit

Permalink
fix: trigger tests set annotations correctly now (#7887)
Browse files Browse the repository at this point in the history
* fix: trigger tests set annotations correctly now

Signed-off-by: Calum Murray <cmurray@redhat.com>

* fix: trigger dependencies are set correctly in test now

Signed-off-by: Calum Murray <cmurray@redhat.com>

* fix trigger template

Signed-off-by: Calum Murray <cmurray@redhat.com>

---------

Signed-off-by: Calum Murray <cmurray@redhat.com>
  • Loading branch information
Cali0707 committed May 7, 2024
1 parent 159d6fc commit 1e6e235
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
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

0 comments on commit 1e6e235

Please sign in to comment.