Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
bprusinowski committed Dec 11, 2023
1 parent bf8765d commit c141556
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions k6/performance-tests/graphql/metadata.js
Original file line number Diff line number Diff line change
@@ -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);
}

0 comments on commit c141556

Please sign in to comment.