mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-02-07 11:36:25 +02:00
Add url groups to k6 script
This commit is contained in:
parent
731218fc7b
commit
9adf06fb04
11
k6/index.js
11
k6/index.js
@ -16,7 +16,12 @@ export let options = {
|
||||
randomSeed(42)
|
||||
|
||||
const urls = new SharedArray('urls', function () {
|
||||
const data = JSON.parse(open('./urls.json'));
|
||||
let data = JSON.parse(open('./urls.json'));
|
||||
|
||||
const groups = (__ENV.URL_GROUPS || "").split(",").filter((g) => g != "")
|
||||
if (groups.length > 0) {
|
||||
data = data.filter((d) => groups.includes(d.group))
|
||||
}
|
||||
|
||||
let unshuffled = [];
|
||||
data.forEach((e) => {
|
||||
@ -36,6 +41,10 @@ const urls = new SharedArray('urls', function () {
|
||||
return shuffled;
|
||||
});
|
||||
|
||||
if (urls.length == 0) {
|
||||
throw "URLs list is empty"
|
||||
}
|
||||
|
||||
export default function() {
|
||||
http.get(urls[exec.scenario.iterationInTest % urls.length])
|
||||
}
|
||||
|
@ -1,13 +1,16 @@
|
||||
[
|
||||
{
|
||||
"url": "/rs:fit:500:500/crop:1000:1000/sh:2/rot:90/wm:1/pd:10/plain/local:///test.jpg",
|
||||
"weight": 5
|
||||
"weight": 5,
|
||||
"group": "jpg"
|
||||
},
|
||||
{
|
||||
"url": "/rs:fit:500:0/plain/local:///test.png",
|
||||
"weight": 2
|
||||
"weight": 2,
|
||||
"group": "png"
|
||||
},
|
||||
{
|
||||
"url": "/rs:fill:300:0/wm:0.5:re:::0.2/plain/local:///test.gif"
|
||||
"url": "/rs:fill:300:0/wm:0.5:re:::0.2/plain/local:///test.gif",
|
||||
"group": "gif"
|
||||
}
|
||||
]
|
||||
|
Loading…
x
Reference in New Issue
Block a user