Skip to content

Commit

Permalink
Added support for additional flags through config
Browse files Browse the repository at this point in the history
Signed-off-by: abdullah1308 <abdullahrafi.1308@gmail.com>
  • Loading branch information
abdullah1308 committed Jul 9, 2023
1 parent e323257 commit b944593
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions api/gowrk2.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type GoWRK2Config struct {
DurationInSeconds, RQPS float64
URL, Labels string
Percentiles []float64
Args []string
}

func WRKRun(config *GoWRK2Config) (*GoWRK2, error) {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b944593

Please sign in to comment.