Skip to content

Commit 86f4799

Browse files
authored
Increase context deadline for TestTaskQueueAPIRateLimitOverridesWorkerLimit (temporalio#8696)
## What changed? Increase flakiness buffer for TestTaskQueueAPIRateLimitOverridesWorkerLimit ## Why? It was still flaky at 3.5s ## How did you test it? - [ ] built - [ ] run locally and tested manually - [ ] covered by existing tests - [ ] added new unit test(s) - [ ] added new functional test(s) ## Potential risks Increasing the flakiness buffer too far could eventually mean this test is worthless. I think 5s is ok though and still tests the rough shape of the API. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Increase buffer/timeout for the task-queue API rate-limit test and adapt chasm parent-pointer test to Get() no-error API. > > - **Tests**: > - **Task queue rate limiting** (`tests/TaskQueueSuite.TestTaskQueueAPIRateLimitOverridesWorkerLimit`): > - Increase flakiness buffer to `3.75s` and extend `drainTimeout` to `30s`. > - Add notes explaining increased buffer/timeout due to flakiness. > - **Chasm tree tests** (`chasm/tree_test.go`): > - Update `assertParentPointer` to use `Get(chasmContext)` without error returns for `SubComponent1` and `SubComponent11`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit f876389. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent a80b487 commit 86f4799

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/task_queue_test.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,11 +261,15 @@ func (s *TaskQueueSuite) configureRateLimitAndLaunchWorkflows(
261261
// The first five activities should run immediately, and the rest should be throttled to 5 RPS.
262262
// The test verifies that the total time taken for all activities to complete is within the expected range
263263
// To avoid test flakiness, the test uses a buffer of 1 second for the expected total time.
264+
// Note: The flakiness buffer has since been increased to 3.5s, but it was still flaky (err context deadline exceeded),
265+
// so I now increased it to 3.75s and increasing the context deadline. If the buffer is >=4s, the test stops
266+
// testing anything because the test will succeed even if all the activities complete immediately as if there were no rate limit.
267+
// TODO(matching team): Possibly rewrite test if this issue persists.
264268
func (s *TaskQueueSuite) TestTaskQueueAPIRateLimitOverridesWorkerLimit() {
265269
const (
266270
apiRPS = 5.0
267271
taskCount = 25
268-
buffer = time.Duration(3.5 * float64(time.Second)) // High Buffer to account for test flakiness
272+
buffer = time.Duration(3.75 * float64(time.Second)) // High Buffer to account for test flakiness
269273
activityTaskQueue = "RateLimitTest"
270274
)
271275
expectedTotal := time.Duration(float64(taskCount-int(apiRPS))/apiRPS) * time.Second
@@ -283,7 +287,8 @@ func (s *TaskQueueSuite) TestTaskQueueAPIRateLimitOverridesWorkerLimit() {
283287
workerRPS = 50.0
284288
// Test typically completes in ~6.2 seconds on average.
285289
// Timeout is set to 10s to reduce flakiness.
286-
drainTimeout = 10 * time.Second
290+
// Note: Flaked at 10s, so trying 30s.
291+
drainTimeout = 30 * time.Second
287292
activityName = "trackableActivity"
288293
)
289294

0 commit comments

Comments
 (0)