@@ -16,8 +16,6 @@ import (
1616 "github.com/form3tech-oss/f1/v2/pkg/f1/scenarios"
1717)
1818
19- const waitForCompletionTimeout = 10 * time .Second
20-
2119func Cmd (
2220 s * scenarios.Scenarios ,
2321 builders []api.Builder ,
@@ -55,6 +53,8 @@ func Cmd(
5553 "--max-failures 10 (load test will fail if more than 10 errors occurred, default is 0)" )
5654 triggerCmd .Flags ().Int (triggerflags .FlagMaxFailuresRate , 0 ,
5755 "--max-failures-rate 5 (load test will fail if more than 5\\ % requests failed, default is 0)" )
56+ triggerCmd .Flags ().Duration (triggerflags .FlagWaitForCompletionTimeout , 10 * time .Second ,
57+ "--wait-for-completion-timeout 10s (wait for completion for 10 seconds)" )
5858 }
5959
6060 triggerCmd .Flags ().AddFlagSet (t .Flags )
@@ -87,6 +87,7 @@ func runCmdExecute(
8787 var maxFailures uint64
8888 var maxFailuresRate int
8989 var ignoreDropped bool
90+ var waitForCompletionTimeout time.Duration
9091 if t .IgnoreCommonFlags {
9192 scenarioName = trig .Options .Scenario
9293 duration = trig .Options .MaxDuration
@@ -95,6 +96,7 @@ func runCmdExecute(
9596 maxFailures = trig .Options .MaxFailures
9697 maxFailuresRate = trig .Options .MaxFailuresRate
9798 ignoreDropped = trig .Options .IgnoreDropped
99+ waitForCompletionTimeout = trig .Options .WaitForCompletionTimeout
98100 } else {
99101 scenarioName = args [0 ]
100102 duration , err = cmd .Flags ().GetDuration (triggerflags .FlagMaxDuration )
@@ -125,6 +127,10 @@ func runCmdExecute(
125127 if err != nil {
126128 return fmt .Errorf ("getting flag: %w" , err )
127129 }
130+ waitForCompletionTimeout , err = cmd .Flags ().GetDuration (triggerflags .FlagWaitForCompletionTimeout )
131+ if err != nil {
132+ return fmt .Errorf ("getting flag: %w" , err )
133+ }
128134 }
129135
130136 verbose , err := cmd .Flags ().GetBool (triggerflags .FlagVerbose )
@@ -151,15 +157,16 @@ func runCmdExecute(
151157 }
152158
153159 run , err := NewRun (options.RunOptions {
154- Scenario : scenarioName ,
155- MaxDuration : duration ,
156- Concurrency : concurrency ,
157- Verbose : verbose ,
158- MaxIterations : maxIterations ,
159- MaxFailures : maxFailures ,
160- MaxFailuresRate : maxFailuresRate ,
161- IgnoreDropped : ignoreDropped ,
162- }, s , trig , waitForCompletionTimeout , settings , metricsInstance , output )
160+ Scenario : scenarioName ,
161+ MaxDuration : duration ,
162+ Concurrency : concurrency ,
163+ Verbose : verbose ,
164+ MaxIterations : maxIterations ,
165+ MaxFailures : maxFailures ,
166+ MaxFailuresRate : maxFailuresRate ,
167+ IgnoreDropped : ignoreDropped ,
168+ WaitForCompletionTimeout : waitForCompletionTimeout ,
169+ }, s , trig , settings , metricsInstance , output )
163170 if err != nil {
164171 return fmt .Errorf ("new run: %w" , err )
165172 }
0 commit comments