diff --git a/pkg/api/v1/testkube/model_test_workflow_step_extended.go b/pkg/api/v1/testkube/model_test_workflow_step_extended.go index b4e87b99f1..4dd28c868f 100644 --- a/pkg/api/v1/testkube/model_test_workflow_step_extended.go +++ b/pkg/api/v1/testkube/model_test_workflow_step_extended.go @@ -67,13 +67,11 @@ func (w *TestWorkflowStep) GetTemplateRefs() []TestWorkflowTemplateRef { } func (w *TestWorkflowStep) HasService(name string) bool { - steps := append(w.Setup, w.Steps...) - if w.Parallel != nil { - steps = append(steps, w.Parallel.Setup...) - steps = append(steps, w.Parallel.Steps...) - steps = append(steps, w.Parallel.After...) + if w.Parallel != nil && w.Parallel.HasService(name) { + return true } + steps := append(w.Setup, w.Steps...) for _, step := range steps { if step.HasService(name) { return true diff --git a/pkg/api/v1/testkube/model_test_workflow_step_parallel_extended.go b/pkg/api/v1/testkube/model_test_workflow_step_parallel_extended.go index 7ad342975e..2a9ccadf86 100644 --- a/pkg/api/v1/testkube/model_test_workflow_step_parallel_extended.go +++ b/pkg/api/v1/testkube/model_test_workflow_step_parallel_extended.go @@ -29,3 +29,18 @@ func (w *TestWorkflowStepParallel) GetTemplateRefs() []TestWorkflowTemplateRef { return templateRefs } + +func (w *TestWorkflowStepParallel) HasService(name string) bool { + steps := append(w.Setup, append(w.Steps, w.After...)...) + for _, step := range steps { + if step.HasService(name) { + return true + } + } + + if _, ok := w.Services[name]; ok { + return true + } + + return false +}