File tree Expand file tree Collapse file tree 2 files changed +19
-10
lines changed Expand file tree Collapse file tree 2 files changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -19,3 +19,4 @@ playwright
19
19
azurite
20
20
aicommits
21
21
genkit
22
+ har-to-k6
Original file line number Diff line number Diff line change 1
- import http from ' k6/http'
2
- import { sleep } from 'k6'
1
+ import http from " k6/http" ;
2
+ import { check , sleep } from "k6" ;
3
3
4
- // See https://grafana.com/docs/k6/latest/using-k6/k6-options/
4
+ // Test configuration
5
5
export const options = {
6
- vus : 10 ,
7
- duration : '30s' ,
8
- cloud : {
9
- name : 'YOUR TEST NAME' ,
6
+ thresholds : {
7
+ // Assert that 99% of requests finish within 3000ms.
8
+ http_req_duration : [ "p(99) < 3000" ] ,
10
9
} ,
11
- }
10
+ // Ramp the number of virtual users up and down
11
+ stages : [
12
+ { duration : "30s" , target : 15 } ,
13
+ { duration : "1m" , target : 15 } ,
14
+ { duration : "20s" , target : 0 } ,
15
+ ] ,
16
+ } ;
12
17
18
+ // Simulated user behavior
13
19
export default function ( ) {
14
- http . get ( 'https://test.k6.io' )
15
- sleep ( 1 )
20
+ let res = http . get ( "https://test-api.k6.io/public/crocodiles/1/" ) ;
21
+ // Validate response status
22
+ check ( res , { "status was 200" : ( r ) => r . status == 200 } ) ;
23
+ sleep ( 1 ) ;
16
24
}
You can’t perform that action at this time.
0 commit comments