-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add har-to-k6 load test conversion script
- Loading branch information
Showing
2 changed files
with
19 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,4 @@ playwright | |
azurite | ||
aicommits | ||
genkit | ||
har-to-k6 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,24 @@ | ||
import http from 'k6/http' | ||
import { sleep } from 'k6' | ||
import http from "k6/http"; | ||
import { check, sleep } from "k6"; | ||
|
||
// See https://grafana.com/docs/k6/latest/using-k6/k6-options/ | ||
// Test configuration | ||
export const options = { | ||
vus: 10, | ||
duration: '30s', | ||
cloud: { | ||
name: 'YOUR TEST NAME', | ||
thresholds: { | ||
// Assert that 99% of requests finish within 3000ms. | ||
http_req_duration: ["p(99) < 3000"], | ||
}, | ||
} | ||
// Ramp the number of virtual users up and down | ||
stages: [ | ||
{ duration: "30s", target: 15 }, | ||
{ duration: "1m", target: 15 }, | ||
{ duration: "20s", target: 0 }, | ||
], | ||
}; | ||
|
||
// Simulated user behavior | ||
export default function () { | ||
http.get('https://test.k6.io') | ||
sleep(1) | ||
let res = http.get("https://test-api.k6.io/public/crocodiles/1/"); | ||
// Validate response status | ||
check(res, { "status was 200": (r) => r.status == 200 }); | ||
sleep(1); | ||
} |