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

Panic when file provided by --data-file exists but is empty #311

Closed
jbub opened this issue Sep 14, 2021 · 0 comments · Fixed by #312
Closed

Panic when file provided by --data-file exists but is empty #311

jbub opened this issue Sep 14, 2021 · 0 comments · Fixed by #312

Comments

@jbub
Copy link
Contributor

jbub commented Sep 14, 2021

Proto file(s)
Any valid proto file.

Command line arguments / config
ghz --insecure --call myservice.MyCall localhost:50052 --data-file 'path/to/data.json'

Describe the bug
When data file is provided using --data-file argument and that file exists but is empty, ghz panics:

panic: runtime error: integer divide by zero

goroutine 1 [running]:
github.com/bojand/ghz/runner.(*dataProvider).getDataForCall(0x140007b6a80, 0x140005086e0)
	github.com/bojand/ghz/runner/data.go:145 +0x210
github.com/bojand/ghz/runner.newDataProvider(0x140002e5b80, 0x0, 0x0, {0x1400013e800, 0x0, 0x200}, 0x0)
	github.com/bojand/ghz/runner/data.go:119 +0x454
github.com/bojand/ghz/runner.NewRequester(0x14000314000)
	github.com/bojand/ghz/runner/requester.go:133 +0x5f0
github.com/bojand/ghz/runner.Run({0x16f3ef3c6, 0x1b}, {0x16f3ef3e2, 0xf}, {0x1400011f908, 0x1, 0x1})
	github.com/bojand/ghz/runner/run.go:31 +0xc8
main.main()
	./main.go:326 +0x5ec

To Reproduce
Use above call and provide data-file that is empty.

Expected behavior
ghz does not panic.

Environment

  • OS: darwin/arm64
  • ghz: 0.102.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant