ci: add scripts for running full test suite with rate limiting #137
+120
−7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adds dedicated scripts for running CI tests with optional rate limiting support.
Why
The test suite has two categories of tests that are conditionally skipped:
Rate limiting tests - These require specific timing windows and request limits to be configured. Running them with default settings would either cause false failures (limits too low) or make the tests meaningless (limits too high). They're skipped by default with
TEST_RATE_LIMITING=false.Admin ban tests - These require authenticated admin credentials (
AUTH_USERNAME/AUTH_PASSWORD) to test the ban functionality. Since CI doesn't have these credentials configured by default, these tests are skipped.Previously, there was no easy way to run the full test suite with these features enabled. Developers had to manually set environment variables and hope they matched what docker-compose expected.
What
ci-env.sh- Sets up the CI Docker environment. The--fullflag exportsTEST_RATE_LIMITING=trueand optionally enables the default admin user if credentials are configured.ci-test.sh- Runs the test suite with proper environment variables. The--fullflag enables rate limiting tests and passes the rate limit configuration to Jest so test assertions match the actual limits.docker-compose.yml - Adds rate limiting environment variables with CI-appropriate defaults (short windows, low limits for fast test execution).
Usage
Test plan
npm run ci:testmockruns standard tests without rate limitingnpm run ci:testmock:fullruns full suite with rate limiting tests