-
Notifications
You must be signed in to change notification settings - Fork 452
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
Handle slicer Toxic with zero SizeVariation #359
Conversation
Removed the use of labels in the tests, also reduced the waiting time for timeout so the tests wait less long to complete. (But much more time than the delay so it won't time out unexpectedly.) |
@areveny It looks like I still have problems random failing tests for Slicer. $ MallocNanoZone=0 go test -v -race -timeout 1m ./...
...
=== RUN TestSlicerToxic
slicer_test.go:53: Expected to read about 480 times, but read 0 times.
slicer_test.go:56: Server did not read correct buffer from client!
--- FAIL: TestSlicerToxic (0.02s) |
5d9e748
to
52578a7
Compare
Reverted the timeout to its original duration. |
Thank you @areveny. Can you please update the title of the current PR and entry in CHANGELOG to make it more informative. Example: Handle toxic slicer when SizeVariation is null. |
Great. All feedback so far has been incorporated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍🏼
I would suggest to take a look at the comment which might be outdated
@areveny Propose to change the code a bit. Moved the +{0,1} to default, according the comment it was connected to part |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small refactorings
I have gone with the approach of removing the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks cleaner 👍🏼
Changes have been release as part of https://github.com/Shopify/toxiproxy/releases/tag/v2.4.0 |
This change skips randomized size variation for the slicer toxic if the
SizeVariation
parameter is 0, which is also the default setting.Additionally, it fixes a small bug in the randomization.
rand.Intn(1)
was being added tomid
to adjust for integer division rounding. However,rand.Intn(n)
returns an integer in the range [0, n), sorand.Intn(1)
always returns 0. It has been changed torand.Intn(2)
.Closes #178