Skip to content

Add quota validation scripts - #144

Open
Kanika0306 wants to merge 3 commits into
sugarlabs:mainfrom
Kanika0306:pr2-quota-validation
Open

Add quota validation scripts#144
Kanika0306 wants to merge 3 commits into
sugarlabs:mainfrom
Kanika0306:pr2-quota-validation

Conversation

@Kanika0306

Copy link
Copy Markdown

What this PR tackles

This PR is an extension of PR #142 and solves Issue #143 by adding application-level validation for the quota persistence work through request-level verification scripts that exercise the API the way a real client would.

Review requested from @sum2it.

Problem

After the backend quota fix, application-level validation was still needed to confirm that quota behavior remains correct through actual API requests, especially around exhaustion and concurrency scenarios.

Fix

This PR adds:

  • concurrency_test.py to stress concurrent quota consumption
  • quota_exhaustion_test.py to verify remaining quota reporting and eventual 429 responses

Validation

These scripts help confirm that:

  • quota information is returned correctly in API responses
  • repeated requests consume quota as expected
  • over-quota requests consistently return 429
  • concurrent requests behave consistently under load

Closes #143

Copilot AI review requested due to automatic review settings May 17, 2026 08:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Comment thread quota_exhaustion_test.py
@@ -0,0 +1,59 @@
import json
import time
Comment thread concurrency_test.py
Comment thread quota_exhaustion_test.py
Comment on lines +2 to +9
import time
import httpx

BASE = "http://127.0.0.1:8000"
API_KEY = "user_key_2"


def main():
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@Kanika0306

Copy link
Copy Markdown
Author

@copilot apply changes based on the comments in this thread

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.

Issue: Add API-Level Validation for Quota Enforcement

2 participants