From d6c4d116def1fff9b4fc911324960d68ffb16cf0 Mon Sep 17 00:00:00 2001 From: Calum Murray Date: Thu, 2 May 2024 15:58:27 -0400 Subject: [PATCH 1/3] fix: trigger tests set annotations correctly now Signed-off-by: Calum Murray --- test/rekt/resources/trigger/trigger.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/test/rekt/resources/trigger/trigger.go b/test/rekt/resources/trigger/trigger.go index dc59d58ba61..65a255c9bd7 100644 --- a/test/rekt/resources/trigger/trigger.go +++ b/test/rekt/resources/trigger/trigger.go @@ -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]interface{}{} } - 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]interface{}) for k, v := range annotations { - ceExt[k] = v + annotation[k] = v } } } From e1e673de0eda7573ae7de990f3c1bdec7c71030a Mon Sep 17 00:00:00 2001 From: Calum Murray Date: Mon, 6 May 2024 14:00:35 -0400 Subject: [PATCH 2/3] fix: trigger dependencies are set correctly in test now Signed-off-by: Calum Murray --- test/rekt/features/trigger/feature.go | 5 +++-- test/rekt/resources/trigger/trigger.go | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/test/rekt/features/trigger/feature.go b/test/rekt/features/trigger/feature.go index 4896fd1c7d7..3fab9d37940 100644 --- a/test/rekt/features/trigger/feature.go +++ b/test/rekt/features/trigger/feature.go @@ -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"}'` annotations := map[string]interface{}{ "knative.dev/dependency": dependencyAnnotation, } @@ -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) diff --git a/test/rekt/resources/trigger/trigger.go b/test/rekt/resources/trigger/trigger.go index 65a255c9bd7..e6ea82a71fe 100644 --- a/test/rekt/resources/trigger/trigger.go +++ b/test/rekt/resources/trigger/trigger.go @@ -125,13 +125,13 @@ func WithSubscriberFromDestination(dest *duckv1.Destination) manifest.CfgFn { func WithAnnotations(annotations map[string]interface{}) manifest.CfgFn { return func(cfg map[string]interface{}) { if _, set := cfg["annotations"]; !set { - cfg["annotations"] = map[string]interface{}{} + cfg["annotations"] = map[string]string{} } if annotations != nil { - annotation := cfg["annotations"].(map[string]interface{}) + annotation := cfg["annotations"].(map[string]string) for k, v := range annotations { - annotation[k] = v + annotation[k] = v.(string) } } } From fd3b48b675dc126c26c26bace396cd156195e100 Mon Sep 17 00:00:00 2001 From: Calum Murray Date: Tue, 7 May 2024 10:42:47 -0400 Subject: [PATCH 3/3] fix trigger template Signed-off-by: Calum Murray --- test/rekt/features/trigger/feature.go | 2 +- test/rekt/resources/trigger/trigger.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/rekt/features/trigger/feature.go b/test/rekt/features/trigger/feature.go index 3fab9d37940..219e48535ce 100644 --- a/test/rekt/features/trigger/feature.go +++ b/test/rekt/features/trigger/feature.go @@ -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"}` annotations := map[string]interface{}{ "knative.dev/dependency": dependencyAnnotation, } diff --git a/test/rekt/resources/trigger/trigger.yaml b/test/rekt/resources/trigger/trigger.yaml index 4521988db44..77d02ad1907 100644 --- a/test/rekt/resources/trigger/trigger.yaml +++ b/test/rekt/resources/trigger/trigger.yaml @@ -20,7 +20,7 @@ metadata: {{ if .annotations }} annotations: {{ range $key, $value := .annotations }} - {{ $key }}: {{ $value }} + {{ $key }}: '{{ $value }}' {{ end }} {{ end }} spec: