-
-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathk6.js
69 lines (57 loc) · 1.84 KB
/
k6.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/**
* Do not run this script or any other loadtest ones against opendor.me
* This script is only here to be used by authorized people.
*
* In case you aren't sure if you are authorized - don't use it.
* It's 99.999% likely that you aren't if you don't know.
*/
import http from 'k6/http';
import {check, sleep} from 'k6';
Array.prototype.random = function () {
return this.sort(() => 0.5 - Math.random())[Math.floor(Math.random() * this.length)];
};
export let options = {
stages: [
{duration: '30s', target: 100},
{duration: '10s', target: 150},
{duration: '2m', target: 150},
{duration: '10s', target: 200},
{duration: '5m', target: 200},
{duration: '10s', target: 225},
{duration: '5m', target: 225},
{duration: '10s', target: 200},
{duration: '5m', target: 200},
{duration: '30s', target: 0},
],
};
export default function () {
let url = [
'https://opendor.me/',
'https://opendor.me/',
'https://opendor.me/',
'https://opendor.me/',
'https://opendor.me/',
'https://opendor.me/',
'https://opendor.me/',
'https://opendor.me/',
'https://opendor.me/',
'https://opendor.me/',
'https://opendor.me/faqs',
'https://opendor.me/faqs',
'https://opendor.me/sponsors',
'https://opendor.me/sponsors',
'https://opendor.me/@Gummibeer',
'https://opendor.me/@Gummibeer',
'https://opendor.me/@Gummibeer',
'https://opendor.me/@Gummibeer',
'https://opendor.me/@Astrotomic',
'https://opendor.me/@Astrotomic',
'https://opendor.me/@Astrotomic',
'https://opendor.me/@Astrotomic',
].random();
let res = http.get(url);
check(res, {
'is status 200': (r) => r.status === 200,
});
sleep(1);
}