Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(venom plugin): add stop-on-failure parameter to venom plugin #5274

Merged
merged 4 commits into from
Jul 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'