File tree 2 files changed +35
-0
lines changed
2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,18 @@ services:
51
51
- ./packages:/app/packages
52
52
privileged : true
53
53
54
+ k6 :
55
+ image : grafana/k6
56
+ container_name : code_blaster_3000_k6
57
+ networks :
58
+ - app-network
59
+ volumes :
60
+ - ./loadtests:/scripts
61
+ command : ["run", "/scripts/test.js"]
62
+ depends_on :
63
+ - server
64
+ - worker
65
+
54
66
networks :
55
67
app-network :
56
68
driver : bridge
Original file line number Diff line number Diff line change
1
+ import http from 'k6/http' ;
2
+
3
+ export const options = {
4
+ scenarios : {
5
+ my_scenario1 : {
6
+ executor : 'constant-arrival-rate' ,
7
+ duration : '30s' , // total duration
8
+ preAllocatedVUs : 50 , // to allocate runtime resources preAll
9
+
10
+ rate : 50 , // number of constant iterations given `timeUnit`
11
+ timeUnit : '1s' ,
12
+ } ,
13
+ } ,
14
+ } ;
15
+
16
+ export default function ( ) {
17
+ const payload = JSON . stringify ( {
18
+ language : 'javaScript' ,
19
+ code : "console.log('Hello, World!');" ,
20
+ } ) ;
21
+ const headers = { 'Content-Type' : 'application/json' } ;
22
+ http . post ( 'http://localhost:3000/api/v1/submit' , payload , { headers } ) ;
23
+ }
You can’t perform that action at this time.
0 commit comments