From 114967fd636d3ed0adbe9d39e87dd5233f17c701 Mon Sep 17 00:00:00 2001 From: Francois Lesage <48120561+storagebits@users.noreply.github.com> Date: Tue, 7 Jul 2020 09:36:43 +0200 Subject: [PATCH] feat(venom plugin): add stop-on-failure parameter to venom plugin (#5274) --- contrib/grpcplugins/action/plugin-venom/main.go | 11 +++++++++++ .../grpcplugins/action/plugin-venom/plugin-venom.yml | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/contrib/grpcplugins/action/plugin-venom/main.go b/contrib/grpcplugins/action/plugin-venom/main.go index 9680ef4515..20e70bd8c3 100644 --- a/contrib/grpcplugins/action/plugin-venom/main.go +++ b/contrib/grpcplugins/action/plugin-venom/main.go @@ -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 = "." @@ -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()) @@ -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, ",") @@ -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) diff --git a/contrib/grpcplugins/action/plugin-venom/plugin-venom.yml b/contrib/grpcplugins/action/plugin-venom/plugin-venom.yml index 0a62f2ca6a..0ef4692d80 100644 --- a/contrib/grpcplugins/action/plugin-venom/plugin-venom.yml +++ b/contrib/grpcplugins/action/plugin-venom/plugin-venom.yml @@ -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'