This is a repository of scripts used to test Chatwoot API. It uses k6 to hit an endpoint with multiple requests and logs the performance
- Instructions to install k6 are documented here. For MacOS, you can install it via brew using
brew install k6 - Run
pnpm ito install dependencies, it installs thedotenv-cliand types for k6. - Copy the
.env.examplefile to.envand add the details - Run
pnpm test scripts/conversation.js
These are the default options exported, which will run 90 iterations, shared over 3 virtual users. You can tweak this to run different scenarios
export const options = {
vus: 3, // https://k6.io/docs/using-k6/k6-options/reference/#vus
iterations: 90, // https://k6.io/docs/using-k6/k6-options/reference/#iterations
throw: true,
};Do not test this on a production instance, as it can disrupt the normal working of the service
- Ensure Rack Attack is enabled on the instance
- Reset the limits before each test by running
Rack::Attack.reset!on the rails console. - Run
pnpm test scripts/rateLimit.sj - The output will run for each configured endpoint
To add a new endpoint create a new file in scripts/endpoints directory, add this endpoint to scripts/endpoints/index.js and that is it. You can find the docs for configuring this here