@@ -25,24 +25,26 @@ var (
2525 path []string
2626 v * venom.Venom
2727
28- variables []string
29- secrets []string
30- format string = "xml" // Set the default value for formatFlag
31- varFiles []string
32- outputDir string
33- libDir string
34- htmlReport bool
35- stopOnFailure bool
36- verbose int = 0 // Set the default value for verboseFlag
37-
38- variablesFlag * []string
39- formatFlag * string
40- varFilesFlag * []string
41- outputDirFlag * string
42- libDirFlag * string
43- stopOnFailureFlag * bool
44- htmlReportFlag * bool
45- verboseFlag * int
28+ variables []string
29+ secrets []string
30+ format string = "xml" // Set the default value for formatFlag
31+ varFiles []string
32+ outputDir string
33+ libDir string
34+ htmlReport bool
35+ stopOnFailure bool
36+ verbose int = 0 // Set the default value for verboseFlag
37+ parallelSuites int = 0 // Number of testsuites to run in parallel (0 = sequential)
38+
39+ variablesFlag * []string
40+ formatFlag * string
41+ varFilesFlag * []string
42+ outputDirFlag * string
43+ libDirFlag * string
44+ stopOnFailureFlag * bool
45+ htmlReportFlag * bool
46+ verboseFlag * int
47+ parallelSuitesFlag * int
4648)
4749
4850func init () {
@@ -54,6 +56,7 @@ func init() {
5456 variablesFlag = Cmd .Flags ().StringArray ("var" , nil , "--var cds='cds -f config.json' --var cds2='cds -f config.json'" )
5557 outputDirFlag = Cmd .PersistentFlags ().String ("output-dir" , "" , "Output Directory: create tests results file inside this directory" )
5658 libDirFlag = Cmd .PersistentFlags ().String ("lib-dir" , "" , "Lib Directory: can contain user executors. example:/etc/venom/lib:$HOME/venom.d/lib" )
59+ parallelSuitesFlag = Cmd .Flags ().Int ("parallel-suites" , 0 , "Number of testsuites to run in parallel (0 or 1 = sequential)" )
5760}
5861
5962func initArgs (cmd * cobra.Command ) {
@@ -115,6 +118,10 @@ func initFromCommandArguments(f *pflag.Flag) {
115118 variables = mergeVariables (varFlag , variables )
116119 }
117120 }
121+ case "parallel-suites" :
122+ if parallelSuitesFlag != nil {
123+ parallelSuites = * parallelSuitesFlag
124+ }
118125 }
119126}
120127
@@ -161,6 +168,7 @@ type ConfigFileData struct {
161168 Secrets * []string `json:"secrets,omitempty" yaml:"secrets,omitempty"`
162169 VariablesFiles * []string `json:"variables_files,omitempty" yaml:"variables_files,omitempty"`
163170 Verbosity * int `json:"verbosity,omitempty" yaml:"verbosity,omitempty"`
171+ ParallelSuites * int `json:"parallel_suites,omitempty" yaml:"parallel_suites,omitempty"`
164172}
165173
166174// Configuration file overrides the environment variables.
@@ -209,6 +217,9 @@ func initFromReaderConfigFile(reader io.Reader) error {
209217 if configFileData .Verbosity != nil {
210218 verbose = * configFileData .Verbosity
211219 }
220+ if configFileData .ParallelSuites != nil {
221+ parallelSuites = * configFileData .ParallelSuites
222+ }
212223
213224 return nil
214225}
@@ -279,6 +290,13 @@ func initFromEnv(environ []string) ([]string, error) {
279290 v2 := int (v )
280291 verbose = v2
281292 }
293+ if os .Getenv ("VENOM_PARALLEL_SUITES" ) != "" {
294+ v , err := strconv .ParseInt (os .Getenv ("VENOM_PARALLEL_SUITES" ), 10 , 64 )
295+ if err != nil {
296+ return nil , fmt .Errorf ("invalid value for VENOM_PARALLEL_SUITES, must be a positive integer" )
297+ }
298+ parallelSuites = int (v )
299+ }
282300
283301 for _ , env := range environ {
284302 if strings .HasPrefix (env , "VENOM_VAR_" ) {
@@ -299,6 +317,7 @@ func displayArg(ctx context.Context) {
299317 venom .Debug (ctx , "option htmlReport=%v" , htmlReport )
300318 venom .Debug (ctx , "option varFiles=%v" , strings .Join (varFiles , " " ))
301319 venom .Debug (ctx , "option verbose=%v" , verbose )
320+ venom .Debug (ctx , "option parallelSuites=%v" , parallelSuites )
302321}
303322
304323// Cmd run
@@ -338,6 +357,7 @@ var Cmd = &cobra.Command{
338357 v .StopOnFailure = stopOnFailure
339358 v .HtmlReport = htmlReport
340359 v .Verbose = verbose
360+ v .ParallelSuites = parallelSuites
341361
342362 if err := v .InitLogger (); err != nil {
343363 fmt .Fprintf (os .Stderr , "%v\n " , err )
0 commit comments