-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Batch rate limit #551
Batch rate limit #551
Conversation
2b31be5
to
8c9470c
Compare
35423f1
to
ffd2c01
Compare
func (s *SharedServerSuite) TestWorkflow_Terminate_BatchWorkflowSuccess_Ratelimit() { | ||
events, _ := s.testTerminateBatchWorkflow(2, 1, false) | ||
delay := events[1].EventTime.AsTime().Sub(events[0].EventTime.AsTime()).Abs() | ||
s.InDelta(delay, 1*time.Second, float64(100*time.Millisecond)) |
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.
In my tests it hasn't always been 1s or greater, so I added a delta here.
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.
This is the kind of test that grows flaky with Go runner slowness I've found. Expecting this margin of error is a bit rough. I think for this you may only need to test that it's set on the outbound request (e.g. w/ gRPC interceptor maybe), you don't need to test server behavior for something like this IMO (that's for the server to test).
@@ -308,6 +324,7 @@ func (s *SharedServerSuite) testTerminateBatchWorkflow(json bool) *CommandResult | |||
// Send batch terminate with a "y" for non-json or "--yes" for json | |||
args := []string{ | |||
"workflow", "terminate", | |||
"--rps", fmt.Sprint(rps), |
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.
This introduces a delay in the test suite of up to 1s. Not sure how to avoid that while still testing the Server end-to-end.
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.
We may have to accept some things cannot reasonably tested in CLI without slowing all tests down.
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. One minor suggestion and concerns about using time-based expectations in tests
@@ -911,6 +911,7 @@ Use the options listed below to change reset behavior. | |||
* `--build-id` (string) - Only used if type is BuildId. Reset the first workflow task processed by this build id. Note that by default, this reset is allowed to be to a prior run in a chain of continue-as-new. | |||
* `--query`, `-q` (string) - Start a batch reset to operate on Workflow Executions with given List Filter. | |||
* `--yes`, `-y` (bool) - Confirm prompt to perform batch. Only allowed if query is present. | |||
* `--rps` (float) - Limit batch's requests per second. Only allowed if query is present. |
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.
Can you update the top of this file to include this new data type in the bullet that lists the data types supported? It's our admittedly-informal "spec".
@@ -308,6 +324,7 @@ func (s *SharedServerSuite) testTerminateBatchWorkflow(json bool) *CommandResult | |||
// Send batch terminate with a "y" for non-json or "--yes" for json | |||
args := []string{ | |||
"workflow", "terminate", | |||
"--rps", fmt.Sprint(rps), |
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.
We may have to accept some things cannot reasonably tested in CLI without slowing all tests down.
func (s *SharedServerSuite) TestWorkflow_Terminate_BatchWorkflowSuccess_Ratelimit() { | ||
events, _ := s.testTerminateBatchWorkflow(2, 1, false) | ||
delay := events[1].EventTime.AsTime().Sub(events[0].EventTime.AsTime()).Abs() | ||
s.InDelta(delay, 1*time.Second, float64(100*time.Millisecond)) |
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.
This is the kind of test that grows flaky with Go runner slowness I've found. Expecting this margin of error is a bit rough. I think for this you may only need to test that it's set on the outbound request (e.g. w/ gRPC interceptor maybe), you don't need to test server behavior for something like this IMO (that's for the server to test).
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 great!
f7e612c
to
096a1b7
Compare
096a1b7
to
422c835
Compare
Let's make sure this is in the next CLI release. |
@stephanos I think the cli-rewrite branch is dead, main becoming the new target branch for the last two weeks, you may want to merge in main instead... @cretz Can you confirm? |
What was changed
Added support for passing
--rps
flag to batch operations.ℹ️ FYI I've only added a single test for TerminateWorkflow, even though there are 3 batch APIs. Reason being that the API is the same and the only difference is the "operation". Let me know if I should add it to the others as well.
❓ Note sure why I'm seeing the CLA request on my PR.
Checklist
Closes
How was this tested: Added new tests.
Any docs updates needed?