From b9445939fbbaa9b1fe2c3c835670d15674083cd6 Mon Sep 17 00:00:00 2001 From: abdullah1308 Date: Mon, 10 Jul 2023 04:05:46 +0530 Subject: [PATCH] Added support for additional flags through config Signed-off-by: abdullah1308 --- api/gowrk2.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/api/gowrk2.go b/api/gowrk2.go index cd71a64..5e7ded1 100644 --- a/api/gowrk2.go +++ b/api/gowrk2.go @@ -49,6 +49,7 @@ type GoWRK2Config struct { DurationInSeconds, RQPS float64 URL, Labels string Percentiles []float64 + Args []string } func WRKRun(config *GoWRK2Config) (*GoWRK2, error) { @@ -77,13 +78,14 @@ func WRKRun(config *GoWRK2Config) (*GoWRK2, error) { "-d" + dur + "s", "-R" + strconv.FormatFloat(config.RQPS, 'f', -1, 64), "-s", scriptLua, rURLI.String()} - logrus.Debugf("received command: wrk %v", args) + config.Args = append(config.Args, args...) + logrus.Debugf("received command: wrk %v", config.Args) var startTime time.Time go func() { startTime = time.Now() }() - out, err := exec.Command(wrkLoc, args...).Output() + out, err := exec.Command(wrkLoc, config.Args...).Output() if err != nil { err = errors.Wrapf(err, "unable to execute the requested command") logrus.Error(err)