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

Better validation of stages #875

Closed
na-- opened this issue Dec 18, 2018 · 2 comments
Closed

Better validation of stages #875

na-- opened this issue Dec 18, 2018 · 2 comments
Assignees
Labels
Milestone

Comments

@na--
Copy link
Member

na-- commented Dec 18, 2018

Currently k6 doesn't properly validate the values in target and duration values in stages. Negative duration and target are allowed, with undefined behavior, when they should be forbidden. Also, a single stage with a duration of 0 (stages: [ { duration: 0, target: 5 } ],) causes a panic:

panic: strings: negative Repeat count-------------------------------] starting

goroutine 1 [running]:
strings.Repeat(0xd141c4, 0x1, 0x800000000000003a, 0x0, 0xc422ebc3a8)
	/usr/lib/golang/src/strings/strings.go:538 +0x1c7
github.com/loadimpact/k6/ui.ProgressBar.String(0x3c, 0x7ff0000000000000, 0xc422ebbf68, 0xc422ebbf58, 0xe8ff01, 0xc425d36980)
	/home/user/go/src/github.com/loadimpact/k6/ui/progress_bar.go:57 +0x408
github.com/loadimpact/k6/cmd.glob..func11(0x14dc500, 0xc420250520, 0x1, 0x1, 0x0, 0x0)
	/home/user/go/src/github.com/loadimpact/k6/cmd/run.go:380 +0x25ba
github.com/loadimpact/k6/vendor/github.com/spf13/cobra.(*Command).execute(0x14dc500, 0xc4202504f0, 0x1, 0x1, 0x14dc500, 0xc4202504f0)
	/home/user/go/src/github.com/loadimpact/k6/vendor/github.com/spf13/cobra/command.go:762 +0x468
github.com/loadimpact/k6/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x14dc2a0, 0x52, 0xc4204f81a0, 0xc4203a4000)
	/home/user/go/src/github.com/loadimpact/k6/vendor/github.com/spf13/cobra/command.go:852 +0x30a
github.com/loadimpact/k6/vendor/github.com/spf13/cobra.(*Command).Execute(0x14dc2a0, 0xc420283f78, 0x405c6c)
	/home/user/go/src/github.com/loadimpact/k6/vendor/github.com/spf13/cobra/command.go:800 +0x2b
github.com/loadimpact/k6/cmd.Execute()
	/home/user/go/src/github.com/loadimpact/k6/cmd/root.go:87 +0x31
main.main()
	/home/user/go/src/github.com/loadimpact/k6/main.go:28 +0x20

It's also unclear how well 0-duration stages (i.e. "suddenly jump up or down from X to Y active VUs") are supported - they should be, we just have to verify it and probably write some tests.

@na--
Copy link
Member Author

na-- commented Mar 1, 2019

This also happens when a script is ran with --vus 1 --iterations 0 --duration 0 ...

@na-- na-- mentioned this issue May 15, 2019
39 tasks
@na-- na-- self-assigned this Aug 27, 2019
@na-- na-- added this to the v1.0.0 milestone Aug 27, 2019
@na-- na-- modified the milestones: v1.0.0, v0.27.0 May 21, 2020
@na--
Copy link
Member Author

na-- commented Jul 6, 2020

Closing this, since the just-merged #1007 implements much better validation and fixes the panic

@na-- na-- closed this as completed Jul 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant