Skip to content

Commit b944593

Browse files
committed
Added support for additional flags through config
Signed-off-by: abdullah1308 <[email protected]>
1 parent e323257 commit b944593

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

api/gowrk2.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ type GoWRK2Config struct {
4949
DurationInSeconds, RQPS float64
5050
URL, Labels string
5151
Percentiles []float64
52+
Args []string
5253
}
5354

5455
func WRKRun(config *GoWRK2Config) (*GoWRK2, error) {
@@ -77,13 +78,14 @@ func WRKRun(config *GoWRK2Config) (*GoWRK2, error) {
7778
"-d" + dur + "s",
7879
"-R" + strconv.FormatFloat(config.RQPS, 'f', -1, 64),
7980
"-s", scriptLua, rURLI.String()}
80-
logrus.Debugf("received command: wrk %v", args)
81+
config.Args = append(config.Args, args...)
82+
logrus.Debugf("received command: wrk %v", config.Args)
8183

8284
var startTime time.Time
8385
go func() {
8486
startTime = time.Now()
8587
}()
86-
out, err := exec.Command(wrkLoc, args...).Output()
88+
out, err := exec.Command(wrkLoc, config.Args...).Output()
8789
if err != nil {
8890
err = errors.Wrapf(err, "unable to execute the requested command")
8991
logrus.Error(err)

0 commit comments

Comments
 (0)