Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runner.WithRunDuration() option not taking precedence over Total Requests (N) #219

Closed
rokane opened this issue Aug 26, 2020 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@rokane
Copy link

rokane commented Aug 26, 2020

Proto file(s)
List protocol buffer definitions

Command line arguments / config

N/A

Describe the bug

When importing ghz and running performance testing using the runner library, the runner.WithRunDuration() option is not being honoured in favour of the default TotalRequests set on the runner.

From looking at the docs on the cli tool options, it suggests that when -z (duration) is set, then -n (total requests) is ignored: Docs reference

Altering the value passed to WithRunDuration() does not result in the runner executing the test for any longer, instead the total count of requests sent is always the default value of 200.

To Reproduce

Example Setup: With run duration of 1 minute

package main

import (
	"fmt"
	"time"

	"github.com/bojand/ghz/runner"
)

func main() {
	opts := []runner.Option{
		runner.WithRunDuration(time.Minute),
		runner.WithData(
			map[string]interface{}{},
		),
	}
	report, err := runner.Run(
		"helloworld.Greeter.SayHello",
		"localhost:8080",
		opts...,
	)
	if err != nil {
		fmt.Printf("error: %v", err)
	}
	fmt.Printf("Total Requests Sent: %v", report.Count)
}

Output: Total Requests Sent: 200

Next Increase Run duration to 2 minutes

package main

import (
	"fmt"
	"time"

	"github.com/bojand/ghz/runner"
)

func main() {
	opts := []runner.Option{
		runner.WithRunDuration(2 * time.Minute),
		runner.WithData(
			map[string]interface{}{},
		),
	}
	report, err := runner.Run(
		"helloworld.Greeter.SayHello",
		"localhost:8080",
		opts...,
	)
	if err != nil {
		fmt.Printf("error: %v", err)
	}
	fmt.Printf("Total Requests Sent: %v", report.Count)
}

Output: Total Requests Sent: 200

Expected behavior

The expected behaviour as stated in the docs, would be that the default total requests value is ignored, and the test will run until the value passed to WithRunDuration() has elapsed.

I would expected to see a different number in the runner.Report.Count value when I increment the duration passed.

Environment

  • OS: macOS 10.14.6
  • ghz: v0.58.0

Screenshots

N/A

Additional context

Found a similar issue from the past which looks related: #14

@bojand bojand added the bug Something isn't working label Aug 30, 2020
@bojand
Copy link
Owner

bojand commented Aug 30, 2020

Hello yes I noticed this recently too. This should be addressed in 0.59.0. If there are more issues with this please reopen.

@bojand bojand closed this as completed Aug 30, 2020
@rokane
Copy link
Author

rokane commented Sep 2, 2020

Thanks @bojand 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants