From a28ca3d1752409366dd5726018b5b9ea9ac63d99 Mon Sep 17 00:00:00 2001 From: Bartosz Prusinowski Date: Mon, 11 Dec 2023 14:29:47 +0100 Subject: [PATCH] WIP --- k6/performance-tests/graphql/metadata.js | 55 ++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 k6/performance-tests/graphql/metadata.js diff --git a/k6/performance-tests/graphql/metadata.js b/k6/performance-tests/graphql/metadata.js new file mode 100644 index 0000000000..7b5d343d3b --- /dev/null +++ b/k6/performance-tests/graphql/metadata.js @@ -0,0 +1,55 @@ +import { sleep } from "k6"; +import http from "k6/http"; + +import { DISTRIBUTION } from "../utils.js"; + +import { getHeaders, getUrl } from "./utils.js"; + +const query = `query DataCubeMetadata( + $sourceType: String! + $sourceUrl: String! + $locale: String! + $cubeFilter: DataCubeMetadataFilter! +) { + dataCubeMetadata( + sourceType: $sourceType + sourceUrl: $sourceUrl + locale: $locale + cubeFilter: $cubeFilter + ) +}`; + +const variables = { + iri: "https://environment.ld.admin.ch/foen/ubd003701/2", + sourceType: "sparql", + sourceUrl: "https://lindas.admin.ch/query", + locale: "en", + componentIris: [ + "https://environment.ld.admin.ch/foen/ubd003701/beurteilung", + "https://environment.ld.admin.ch/foen/ubd003701/gemeindetype", + "https://environment.ld.admin.ch/foen/ubd003701/laermbelasteteeinheit", + ], +}; + +const env = __ENV.ENV; +const enableCache = __ENV.ENABLE_GQL_SERVER_SIDE_CACHE === "true"; + +/** @type {import("k6/options").Options} */ +export const options = { + iterations: 1, + ext: { + loadimpact: { + name: `GraphQL - Components (${env.toUpperCase()}, GQL ${ + enableCache ? "cache" : "no-cache" + })`, + distribution: DISTRIBUTION, + }, + }, +}; + +export default function Components() { + http.post(getUrl(env), JSON.stringify({ query, variables }), { + headers: getHeaders(enableCache), + }); + sleep(1); +}