Skip to content

test : added unit tests for RateLimiter and WorkflowRateLimiter helpers#1228

Open
tmdeveloper007 wants to merge 1 commit into
utksh1:mainfrom
tmdeveloper007:#1223
Open

test : added unit tests for RateLimiter and WorkflowRateLimiter helpers#1228
tmdeveloper007 wants to merge 1 commit into
utksh1:mainfrom
tmdeveloper007:#1223

Conversation

@tmdeveloper007

Copy link
Copy Markdown
Contributor

Closes #1223.

Summary of What Has Been Done:
Created testing/backend/unit/test_ratelimit.py covering the RateLimiter and WorkflowRateLimiter helpers from backend.secuscan.ratelimit. These are genuinely uncovered by test_endpoint_rate_limiter.py (which covers EndpointRateLimiter and resolve_client_identity).

Changes Made:

  • RateLimiter.can_execute: 6 tests covering quota enforcement, old-entry cleanup, per-client and per-plugin bucket isolation, and default client_id
  • RateLimiter.reset: 2 tests covering per-plugin reset and global reset
  • WorkflowRateLimiter.check_workflow_rate_limit: 4 tests covering first-run allow, interval denial with remaining-seconds message, after-interval allow, and independent per-workflow limits
  • 12 tests total, all passing with pytest-asyncio

Impact it Made:
Zero test coverage for the core per-client rate limiter and the workflow scheduler rate limiter. Bugs in quota accounting or bucket isolation would silently allow rate limit bypasses. This brings ratelimit module unit test coverage to ~90%.

Note: This task is being handled by tmdeveloper007 — please assign to that account when picking it up.

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.

test : add unit tests for RateLimiter and WorkflowRateLimiter pure helpers

1 participant