Skip to content

Commit

Permalink
fix: trigger dependencies are set correctly in test now
Browse files Browse the repository at this point in the history
Signed-off-by: Calum Murray <cmurray@redhat.com>
  • Loading branch information
Cali0707 authored and knative-prow-robot committed Jun 27, 2024
1 parent d6c4d11 commit e1e673d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
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"}'`
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
6 changes: 3 additions & 3 deletions test/rekt/resources/trigger/trigger.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down

0 comments on commit e1e673d

Please sign in to comment.