Skip to content

test : added unit tests for rate limiter classes#1081

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

test : added unit tests for rate limiter classes#1081
tmdeveloper007 wants to merge 1 commit into
utksh1:mainfrom
tmdeveloper007:#1076

Conversation

@tmdeveloper007

Copy link
Copy Markdown
Contributor

Closes #1076.

Summary of What Has Been Done:
Added testing/backend/unit/test_ratelimit.py covering RateLimiter and ConcurrentTaskLimiter in backend.secuscan.ratelimit. 11 tests, all passing.

Changes Made:

  • Created testing/backend/unit/test_ratelimit.py
  • RateLimiter: allows within quota, blocks when exhausted, tracks per-client-per-plugin independently, uses global as default client_id, reset(plugin_id) clears only that plugin, reset(None) clears all buckets
  • ConcurrentTaskLimiter: acquire succeeds under limit, fails at limit, release frees a slot, release of unknown task is a no-op, get_available_slots returns correct count

Impact it Made:
Zero test coverage for the rate limiting module. These classes protect the backend from runaway task spawning and enforce per-client rate limits. Untested, a bug in the sliding window or concurrent slot logic could silently allow DoS or resource exhaustion.

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 rate limiter classes

1 participant