Created
September 2, 2025 05:51
-
-
Save netanelavr/6a268a64c8b67fa2093db2e2b02bec01 to your computer and use it in GitHub Desktop.
stress-test-prompt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# API Stress Test | |
Create a Bash-based stress testing suite that simulates real user interactions with | |
your API and measures system performance under load. | |
## Core Script (`api_stress_test.sh`) | |
- Simulate realistic user flows with sequential API calls (GET, POST, PUT, DELETE) | |
- DELETE requests should be executed last to clean up test data | |
- Support bearer token authentication and custom headers | |
- Base URL should be configurable | |
- Inject stress test identifiers (`testId`, `isStressTest=true`) into headers or payload | |
- Use `wget` (instead of `curl`) for compatibility with K8s/minimal containers | |
## Server-Side Integration | |
Implement middleware that: | |
- Detect stress test flags from headers or payload | |
- Add contextual data to logs (e.g., `testId`, timestamps) | |
- Exclude stress test requests from monitoring tools (e.g., Sentry, Langfuse) | |
- Support conditional logic (e.g., bypass throttling, enable mocks, suppress alerts) | |
## Logging | |
- Log each request with: timestamp, HTTP method and URL, status code, response time | |
- Save logs to timestamped files (`test_001.log`, etc.) | |
## Wrapper Script (`run_stress_tests.sh`) | |
- Run the core script multiple times in parallel | |
- Configurable total runs | |
- Limit maximum concurrency | |
- At the end, generate a summary report with: | |
- Total successes and failures | |
- Response time statistics (average, minimum, maximum) | |
- HTTP status code distribution | |
## Implementation | |
Build two Bash scripts: | |
1. `api_stress_test.sh` – runs one sequence of API calls with logging | |
2. `run_stress_tests.sh` – runs the first script N times concurrently and produces a summary | |
--- | |
Before you start - | |
What additional context do you need to tailor this to our environment? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment