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

Integration test for workflow ID based rate limiting task processing #5933

Merged
merged 11 commits into from
Apr 26, 2024

Conversation

sankari165
Copy link
Member

What changed?
New integration test for verifying rate limiting of task processing

Why?
testing

How did you test it?
Ran it locally

Potential risks
No risks with testing

Release notes

Documentation Changes

Copy link

codecov bot commented Apr 23, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 62.61%. Comparing base (9cbff9c) to head (2943fea).

Additional details and impacted files

see 3 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9cbff9c...2943fea. Read the comment docs.

host/workflowsidinternalratelimit_test.go Show resolved Hide resolved
host/workflowsidinternalratelimit_test.go Outdated Show resolved Hide resolved
host/workflowsidinternalratelimit_test.go Show resolved Hide resolved
history := historyResponse.History
firstEvent := history.Events[0]
lastEvent := history.Events[len(history.Events)-1]
// First 7 event ids --> 0 (Workflow start), 1-3 ( Decision scheduled,started,completed) , 4-6 (Activity scheduled,started,completed) post which the tasks will be rate limited since RPS is 2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not super clear to me how this test validates workflow id rate limits. how do you ensure these specific events are spread with 2 rps?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These events correspond to two tasks - one decision task and one activity task. The ratelimiter is at the task processing level and after processing 2 tasks, the rate limiter starts to return an error

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess there's no externally visible error being returned, just a delay?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes there is no externally visible error since the rate limit error is being retried and delays the task processing

s.Logger.Info("Waiting for workflow to complete", tag.WorkflowRunID(we.RunID))

s.False(workflowComplete)
_, err = poller.PollAndProcessDecisionTask(false, false)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not super familiar with these engine tests. Does this block here waiting for a reponse (for N seconds or whatever) until there's a task?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has a fixed 5 attempts and then says no tasks found

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

host/taskpoller.go

@sankari165 sankari165 merged commit 5494354 into cadence-workflow:master Apr 26, 2024
20 checks passed
@coveralls
Copy link

Pull Request Test Coverage Report for Build 018f1a68-5336-41ff-8437-f9fa1d1611d9

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 70 unchanged lines in 12 files lost coverage.
  • Overall coverage decreased (-0.01%) to 67.769%

Files with Coverage Reduction New Missed Lines %
common/task/weighted_round_robin_task_scheduler.go 2 88.06%
common/cache/lru.go 2 92.89%
common/persistence/sql/sqlplugin/mysql/task.go 2 73.68%
service/history/task/transfer_active_task_executor.go 2 72.85%
service/matching/taskListManager.go 2 81.16%
common/persistence/sql/sqlplugin/mysql/db.go 2 79.49%
common/persistence/historyManager.go 2 66.67%
common/task/fifo_task_scheduler.go 5 84.54%
service/history/task/fetcher.go 6 85.05%
service/history/task/transfer_standby_task_executor.go 8 86.42%
Totals Coverage Status
Change from base Build 018f185f-6b8d-4346-91c0-8e814148aa4f: -0.01%
Covered Lines: 99449
Relevant Lines: 146748

💛 - Coveralls

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 this pull request may close these issues.

4 participants