Skip to content

Commit

Permalink
feat(venom plugin): add stop-on-failure parameter to venom plugin (#5274
Browse files Browse the repository at this point in the history
)
  • Loading branch information
storagebits authored Jul 7, 2020
1 parent 92aa63f commit 114967f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions contrib/grpcplugins/action/plugin-venom/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func (actPlugin *venomActionPlugin) Run(ctx context.Context, q *actionplugin.Act
loglevel := q.GetOptions()["loglevel"]
vars := q.GetOptions()["vars"]
varsFromFile := q.GetOptions()["vars-from-file"]
stopOnFailureStr := q.GetOptions()["stop-on-failure"]

if path == "" {
path = "."
Expand All @@ -75,6 +76,14 @@ func (actPlugin *venomActionPlugin) Run(ctx context.Context, q *actionplugin.Act
}, nil
}

stopOnFailure := false
if stopOnFailureStr != "" {
stopOnFailure, err = strconv.ParseBool(stopOnFailureStr)
if err != nil {
return actionplugin.Fail("Error parsing stopOnFailure value : %v\n", err)
}
}

v := venom.New()
v.RegisterExecutor(exec.Name, exec.New())
v.RegisterExecutor(http.Name, http.New())
Expand Down Expand Up @@ -158,6 +167,7 @@ func (actPlugin *venomActionPlugin) Run(ctx context.Context, q *actionplugin.Act
v.OutputFormat = "xml"
v.OutputDir = output
v.Parallel = parallel
v.StopOnFailure = stopOnFailure

filepathVal := strings.Split(path, ",")
filepathExcluded := strings.Split(exclude, ",")
Expand Down Expand Up @@ -190,6 +200,7 @@ func (actPlugin *venomActionPlugin) Run(ctx context.Context, q *actionplugin.Act

fmt.Printf("VENOM - filepath: %v\n", filepathValComputed)
fmt.Printf("VENOM - excluded: %v\n", filepathExcludedComputed)
fmt.Printf("VENOM - stop on failure: %t\n", stopOnFailure)
tests, err := v.Process(filepathValComputed, filepathExcludedComputed)
if err != nil {
return actionplugin.Fail("VENOM - Fail on venom: %v\n", err)
Expand Down
4 changes: 4 additions & 0 deletions contrib/grpcplugins/action/plugin-venom/plugin-venom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ parameters:
vars-from-file:
type: string
description: 'filename.yaml or filename.json. See https://github.com/ovh/venom#run-venom-with-file-var'
stop-on-failure:
type: boolean
description: 'Stop running Test Suite on first Test Case failure'
default: 'true'

0 comments on commit 114967f

Please sign in to comment.