Skip to content

Commit

Permalink
fix: add method to parallel step
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Sukhin <[email protected]>
  • Loading branch information
vsukhin committed Nov 29, 2024
1 parent c2fd448 commit b46bb41
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
8 changes: 3 additions & 5 deletions pkg/api/v1/testkube/model_test_workflow_step_extended.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions pkg/api/v1/testkube/model_test_workflow_step_parallel_extended.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

0 comments on commit b46bb41

Please sign in to comment.