@@ -13,6 +13,7 @@ import { user, client } from './constants.js';
13
13
import exec from 'k6/execution' ;
14
14
15
15
let config = JSON . parse ( open ( __ENV . CONFIG ) ) ;
16
+ let scenario = __ENV . SCENARIO ;
16
17
const username = config . kcLoadTest . username ;
17
18
const password = config . kcLoadTest . password ;
18
19
const clientId = config . kcLoadTest . clientId ;
@@ -30,57 +31,59 @@ const formattedDate = `${date.getFullYear()}${('0' + (date.getMonth() + 1)).slic
30
31
- 2 ,
31
32
) } ${ date . getHours ( ) } ${ ( '0' + date . getMinutes ( ) ) . slice ( - 2 ) } `;
32
33
33
- export const options = {
34
- scenarios : {
35
- peakProfile : {
36
- executor : 'constant-arrival-rate' ,
37
- duration : '2m' ,
38
- timeUnit : '1m' ,
39
- rate : 34 ,
40
- preAllocatedVUs : 5 ,
41
- tags : {
42
- profile : 'peak-2h-34' ,
43
- } ,
34
+ const scenarios = {
35
+ peakProfile : {
36
+ executor : 'constant-arrival-rate' ,
37
+ duration : '2h' ,
38
+ timeUnit : '1m' ,
39
+ rate : 34 ,
40
+ preAllocatedVUs : 5 ,
41
+ tags : {
42
+ profile : 'peak' ,
43
+ } ,
44
+ } ,
45
+ stressProfile : {
46
+ executor : 'ramping-arrival-rate' , //Assure load increase if the system slows
47
+ startRate : 0 ,
48
+ timeUnit : '1m' ,
49
+ preAllocatedVUs : 10000 ,
50
+ stages : [
51
+ // Ramp in 100 req/sec intervals, and hold 5 mins.
52
+ // Each loop runs 3 req/sec, so (target * 3) / 60 = req/sec.
53
+ { duration : '5m' , target : 2000 } ,
54
+ { duration : '5m' , target : 2000 } ,
55
+ { duration : '5m' , target : 4000 } ,
56
+ { duration : '5m' , target : 4000 } ,
57
+ { duration : '5m' , target : 6000 } ,
58
+ { duration : '5m' , target : 6000 } ,
59
+ { duration : '5m' , target : 8000 } ,
60
+ { duration : '5m' , target : 8000 } ,
61
+ { duration : '5m' , target : 10000 } ,
62
+ { duration : '5m' , target : 10000 } ,
63
+ ] ,
64
+ tags : {
65
+ profile : 'stress' ,
44
66
} ,
45
- // stress: {
46
- // executor: 'ramping-arrival-rate', //Assure load increase if the system slows
47
- // startRate: 0,
48
- // timeUnit: '1m',
49
- // preAllocatedVUs: 10000,
50
- // stages: [
51
- // // Ramp in 100 req/sec intervals, and hold 5 mins.
52
- // // Each loop runs 3 req/sec, so (target * 3) / 60 = req/sec.
53
- // { duration: '5m', target: 2000 },
54
- // { duration: '5m', target: 2000 },
55
- // { duration: '5m', target: 4000 },
56
- // { duration: '5m', target: 4000 },
57
- // { duration: '5m', target: 6000 },
58
- // { duration: '5m', target: 6000 },
59
- // { duration: '5m', target: 8000 },
60
- // { duration: '5m', target: 8000 },
61
- // { duration: '5m', target: 10000 },
62
- // { duration: '5m', target: 10000 },
63
- // ],
64
- // tags: {
65
- // profile: 'stress-5m-2000',
66
- // },
67
- // },
67
+ } ,
68
68
69
- // stress: {
70
- // executor: 'ramping-arrival-rate', //Assure load increase if the system slows
71
- // startRate: BASELINE_RATE,
72
- // timeUnit: '1m',
73
- // preAllocatedVUs: 20000,
74
- // stages: [
75
- // { duration: '1m', target: BASELINE_RATE }, // just slowly ramp-up to a HUGE load
76
- // // just slowly ramp-up to an EPIC load.
77
- // { duration: '1h', target: 20000 },
78
- // ],
79
- // tags: {
80
- // profile: 'stress-1h-20000',
81
- // },
82
- // },
69
+ soakProfile : {
70
+ executor : 'ramping-arrival-rate' , //Assure load increase if the system slows
71
+ startRate : BASELINE_RATE ,
72
+ timeUnit : '1m' ,
73
+ preAllocatedVUs : 20000 ,
74
+ stages : [
75
+ { duration : '1m' , target : BASELINE_RATE } , // just slowly ramp-up to a HUGE load
76
+ // just slowly ramp-up to an EPIC load.
77
+ { duration : '1h' , target : 20000 } ,
78
+ ] ,
79
+ tags : {
80
+ profile : 'soak' ,
81
+ } ,
83
82
} ,
83
+ } ;
84
+
85
+ export const options = {
86
+ scenarios : { [ scenario ] : scenarios [ scenario ] } ,
84
87
thresholds : {
85
88
http_req_failed : [
86
89
{
0 commit comments