Skip to content

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

Merged
utksh1 merged 3 commits into
utksh1:mainfrom
tmdeveloper007:#1223
Jun 24, 2026
Merged

test : added unit tests for RateLimiter and WorkflowRateLimiter helpers#1228
utksh1 merged 3 commits 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.

@utksh1 utksh1 merged commit 6f5a936 into utksh1:main Jun 24, 2026
6 of 7 checks passed
@utksh1 utksh1 added the gssoc:approved Admin validation: approved for GSSoC scoring label Jun 24, 2026
utksh1 added a commit that referenced this pull request Jun 25, 2026
, #1234, #1232, #1231, #1230, #1229, #1228, #1222, #1221, #1254, #1252, #1251, #1250, #1242, #1255, #1090, #1097, #1112)

Reverting all PR merges performed during this session to restore repository
to pre-session state. This reverts commits:
- e376276 (#1255)
- 18e5101 (#1222)
- e516dd5 (#1230)
- be400fa (#1235)
- d522e9a (#1243)
- bc0b1cd (#1090)
- de56660 (#1097)
- c2a5a53 (#1112)
- eb30d33 (#1254)
- f2a67f7 (#1250)
- 6579112 (#1251)
- 8751d92 (#1252)
- 3ebc935 (#1221)
- 6f5a936 (#1228)
- da15da4 (#1229)
- b66a5b0 (#1231)
- 775c5c2 (#1232)
- b529ddb (#1234)
- 965b001 (#1241)
- d46e573 (#1242)
- dd09955 (#1240)

All PRs are also being reopened and gssoc labels removed.
@utksh1 utksh1 added level:beginner 20 pts difficulty label for small beginner-friendly PRs type:testing Testing work category bonus label area:backend Backend API, database, or service work gssoc:approved Admin validation: approved for GSSoC scoring and removed gssoc:approved Admin validation: approved for GSSoC scoring labels Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:backend Backend API, database, or service work gssoc:approved Admin validation: approved for GSSoC scoring level:beginner 20 pts difficulty label for small beginner-friendly PRs type:testing Testing work category bonus label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test : add unit tests for RateLimiter and WorkflowRateLimiter pure helpers

2 participants