Skip to content

Commit 3755819

Browse files
[release-1.14] fix: trigger tests set annotations correctly now (#8053)
* fix: trigger tests set annotations correctly now Signed-off-by: Calum Murray <[email protected]> * fix: trigger dependencies are set correctly in test now Signed-off-by: Calum Murray <[email protected]> * fix trigger template Signed-off-by: Calum Murray <[email protected]> --------- Signed-off-by: Calum Murray <[email protected]> Co-authored-by: Calum Murray <[email protected]>
1 parent 865f144 commit 3755819

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

test/rekt/features/trigger/feature.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ func TriggerDependencyAnnotation() *feature.Feature {
6969
// Install the trigger
7070
f.Setup("install trigger", trigger.Install(triggerName, brokerName, cfg...))
7171

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

7475
f.Requirement("install pingsource", func(ctx context.Context, t feature.T) {
7576
brokeruri, err := broker.Address(ctx, brokerName)

test/rekt/resources/trigger/trigger.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,18 +124,14 @@ func WithSubscriberFromDestination(dest *duckv1.Destination) manifest.CfgFn {
124124
// WithAnnotations adds annotations to the trigger
125125
func WithAnnotations(annotations map[string]interface{}) manifest.CfgFn {
126126
return func(cfg map[string]interface{}) {
127-
if _, set := cfg["ceOverrides"]; !set {
128-
cfg["ceOverrides"] = map[string]interface{}{}
127+
if _, set := cfg["annotations"]; !set {
128+
cfg["annotations"] = map[string]string{}
129129
}
130-
ceOverrides := cfg["ceOverrides"].(map[string]interface{})
131130

132131
if annotations != nil {
133-
if _, set := ceOverrides["annotations"]; !set {
134-
ceOverrides["annotations"] = map[string]interface{}{}
135-
}
136-
ceExt := ceOverrides["annotations"].(map[string]interface{})
132+
annotation := cfg["annotations"].(map[string]string)
137133
for k, v := range annotations {
138-
ceExt[k] = v
134+
annotation[k] = v.(string)
139135
}
140136
}
141137
}

test/rekt/resources/trigger/trigger.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ metadata:
2020
{{ if .annotations }}
2121
annotations:
2222
{{ range $key, $value := .annotations }}
23-
{{ $key }}: {{ $value }}
23+
{{ $key }}: '{{ $value }}'
2424
{{ end }}
2525
{{ end }}
2626
spec:

0 commit comments

Comments
 (0)