0

Added load testing using artillery

This commit is contained in:
rafaelsideguide 2024-05-17 18:32:44 -03:00
parent a480595aa7
commit 7297b21dcd
3 changed files with 79 additions and 1 deletions

View File

@ -16,6 +16,22 @@ npx playwright install
npm run test npm run test
``` ```
## Running Load Tests with Artillery
To run load tests using Artillery, follow these steps:
1. Install Artillery globally if you haven't already:
```bash
npm install -g artillery
```
2. Run the load test:
```bash
artillery run load-test.yml
```
## Test Results ## Test Results
The tests are designed to cover various aspects of the system, including: The tests are designed to cover various aspects of the system, including:

View File

@ -0,0 +1,60 @@
config:
target: "https://api.firecrawl.dev/v0" # <<< ADD HERE THE URL FOR THE STAGING ENVIRONMENT
phases:
- duration: 1
arrivalRate: 5
defaults:
headers:
Authorization: "Bearer {{ $env.TEST_API_KEY }}"
scenarios:
- name: Scrape a URL
flow:
- post:
url: "/scrape"
json:
url: "https://www.scrapethissite.com"
pageOptions:
onlyMainContent: true
capture:
- json: "$.data.markdown"
as: markdown_content
# - name: Crawl a URL
# flow:
# - post:
# url: "/crawl"
# json:
# url: "https://mendable.ai"
# crawlerOptions:
# includes: []
# excludes: ["blog/*"]
# limit: 100
# pageOptions:
# onlyMainContent: true
# capture:
# - json: "$.jobId"
# as: job_id
# - get:
# url: "/crawl/status/{{ job_id }}"
# capture:
# - json: "$.status"
# as: crawl_status
# until:
# - condition: "equals"
# value: "completed"
# variable: "crawl_status"
# retry:
# count: 20
# wait: 10
# - name: Search for a query
# flow:
# - post:
# url: "/search"
# json:
# query: "firecrawl"
# pageOptions:
# fetchPageContent: true
# capture:
# - json: "$.data[0].markdown"
# as: search_markdown_content

View File

@ -3,7 +3,9 @@
"version": "1.0.0", "version": "1.0.0",
"description": "", "description": "",
"scripts": { "scripts": {
"test": "npx jest --detectOpenHandles --forceExit --openHandlesTimeout=120000 --watchAll=false" "test:suite": "npx jest --detectOpenHandles --forceExit --openHandlesTimeout=120000 --watchAll=false",
"test:load": "artillery run load-test.yml",
"fly:staging": "fly deploy -c fly.staging.toml"
}, },
"author": "", "author": "",
"license": "ISC", "license": "ISC",