Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Add extra checks to k6 load test script (#5384)

hq1e017ec326837
diff --git a/test/load/script.js b/test/load/script.js
index 68cac6d1e3..0d2c4fab20 100644
--- a/test/load/script.js
+++ b/test/load/script.js
@@ -1,4 +1,5 @@
import http from "k6/http";
+import { check } from "k6";
const PAYLOAD = JSON.stringify({
n: "pageview",
@@ -42,5 +43,14 @@ export const options = {
};
export default function () {
- http.post("http://localhost:8000/api/event", PAYLOAD, newParams());
+ const res = http.post(
+ "http://localhost:8000/api/event",
+ PAYLOAD,
+ newParams(),
+ );
+
+ check(res, {
+ "is accepted": (r) => r.body === "ok",
+ "is buffered": (r) => r.headers["X-Plausible-Dropped"] !== "1",
+ });
}