feat(ext): expose GoValue() and PHPValue() functions (#1877)

* feat(ext): expose a GoValue function

* GoValue()
This commit is contained in:
Kévin Dunglas
2025-09-15 16:25:11 +02:00
committed by GitHub
parent 960dd209f7
commit 52a0be5728
25 changed files with 429 additions and 413 deletions

View File

@@ -1,4 +1,4 @@
import http from 'k6/http'
import http from "k6/http";
/**
* Modern databases tend to have latencies in the single-digit milliseconds.
@@ -6,25 +6,27 @@ import http from 'k6/http'
*/
export const options = {
stages: [
{ duration: '20s', target: 100 },
{ duration: '30s', target: 200 },
{ duration: '10s', target: 0 }
{ duration: "20s", target: 100 },
{ duration: "30s", target: 200 },
{ duration: "10s", target: 0 },
],
thresholds: {
http_req_failed: ['rate<0.01']
}
}
http_req_failed: ["rate<0.01"],
},
};
/* global __ENV */
export default function () {
// 1-10ms latency
const latency = Math.floor(Math.random() * 10) + 1
const latency = Math.floor(Math.random() * 10) + 1;
// 1-2 iterations per request
const iterations = Math.floor(Math.random() * 2) + 1
const iterations = Math.floor(Math.random() * 2) + 1;
// 1-30000 work units per iteration
const work = Math.ceil(Math.random() * 30000)
const work = Math.ceil(Math.random() * 30000);
// 1-40 output units
const output = Math.ceil(Math.random() * 40)
const output = Math.ceil(Math.random() * 40);
http.get(http.url`${__ENV.CADDY_HOSTNAME}/sleep.php?sleep=${latency}&work=${work}&output=${output}&iterations=${iterations}`)
http.get(
http.url`${__ENV.CADDY_HOSTNAME}/sleep.php?sleep=${latency}&work=${work}&output=${output}&iterations=${iterations}`,
);
}