diff --git a/k6/performance-tests/graphql/DataCubeComponents.js b/k6/performance-tests/graphql/DataCubeComponents.js index f0cbfceab..a7ff7a69b 100644 --- a/k6/performance-tests/graphql/DataCubeComponents.js +++ b/k6/performance-tests/graphql/DataCubeComponents.js @@ -2,6 +2,9 @@ import { check } from "k6"; import exec from "k6/execution"; import http from "k6/http"; +const rootPath = __ENV.ROOT_PATH || "../../../"; +const cubes = require(`${rootPath}k6/performance-tests/data.js`); + const query = `query DataCubeComponents( $sourceType: String! $sourceUrl: String! @@ -20,6 +23,7 @@ const env = __ENV.ENV; const cubeIri = __ENV.CUBE_IRI; const cubeLabel = __ENV.CUBE_LABEL; const endpoint = __ENV.ENDPOINT; +const metadata = cubes.find((cube) => cube.iri === cubeIri); const variables = { locale: "en", @@ -33,6 +37,11 @@ const variables = { /** @type {import("k6/options").Options} */ export const options = { iterations: 2, + thresholds: { + http_req_duration: [ + `avg<${2 * metadata.queries.DataCubeComponents.expectedDuration}`, + ], + }, }; const headers = { diff --git a/k6/performance-tests/graphql/DataCubeMetadata.js b/k6/performance-tests/graphql/DataCubeMetadata.js index c75a37bf5..ddeb17534 100644 --- a/k6/performance-tests/graphql/DataCubeMetadata.js +++ b/k6/performance-tests/graphql/DataCubeMetadata.js @@ -2,6 +2,9 @@ import { check } from "k6"; import exec from "k6/execution"; import http from "k6/http"; +const rootPath = __ENV.ROOT_PATH || "../../../"; +const cubes = require(`${rootPath}k6/performance-tests/data.js`); + const query = `query DataCubeMetadata( $sourceType: String! $sourceUrl: String! @@ -20,6 +23,7 @@ const env = __ENV.ENV; const cubeIri = __ENV.CUBE_IRI; const cubeLabel = __ENV.CUBE_LABEL; const endpoint = __ENV.ENDPOINT; +const metadata = cubes.find((cube) => cube.iri === cubeIri); const variables = { locale: "en", @@ -33,6 +37,11 @@ const variables = { /** @type {import("k6/options").Options} */ export const options = { iterations: 2, + thresholds: { + http_req_duration: [ + `avg<${2 * metadata.queries.DataCubeMetadata.expectedDuration}`, + ], + }, }; const headers = { diff --git a/k6/performance-tests/graphql/DataCubeObservations.js b/k6/performance-tests/graphql/DataCubeObservations.js index d57ef5ecb..e76726568 100644 --- a/k6/performance-tests/graphql/DataCubeObservations.js +++ b/k6/performance-tests/graphql/DataCubeObservations.js @@ -38,6 +38,11 @@ const variables = { /** @type {import("k6/options").Options} */ export const options = { iterations: 2, + thresholds: { + http_req_duration: [ + `avg<${2 * metadata.queries.DataCubeObservations.expectedDuration}`, + ], + }, }; const headers = { diff --git a/k6/performance-tests/graphql/DataCubePreview.js b/k6/performance-tests/graphql/DataCubePreview.js index 0352f8876..396fefe87 100644 --- a/k6/performance-tests/graphql/DataCubePreview.js +++ b/k6/performance-tests/graphql/DataCubePreview.js @@ -2,6 +2,9 @@ import { check } from "k6"; import exec from "k6/execution"; import http from "k6/http"; +const rootPath = __ENV.ROOT_PATH || "../../../"; +const cubes = require(`${rootPath}k6/performance-tests/data.js`); + const query = `query DataCubePreview( $sourceType: String! $sourceUrl: String! @@ -20,6 +23,7 @@ const env = __ENV.ENV; const cubeIri = __ENV.CUBE_IRI; const cubeLabel = __ENV.CUBE_LABEL; const endpoint = __ENV.ENDPOINT; +const metadata = cubes.find((cube) => cube.iri === cubeIri); const variables = { locale: "en", @@ -34,6 +38,11 @@ const variables = { /** @type {import("k6/options").Options} */ export const options = { iterations: 2, + thresholds: { + http_req_duration: [ + `avg<${2 * metadata.queries.DataCubePreview.expectedDuration}`, + ], + }, }; const headers = { diff --git a/k6/performance-tests/graphql/PossibleFilters.js b/k6/performance-tests/graphql/PossibleFilters.js index b1d36a83c..58bc5241a 100644 --- a/k6/performance-tests/graphql/PossibleFilters.js +++ b/k6/performance-tests/graphql/PossibleFilters.js @@ -40,6 +40,11 @@ const variables = { /** @type {import("k6/options").Options} */ export const options = { iterations: 2, + thresholds: { + http_req_duration: [ + `avg<${2 * metadata.queries.PossibleFilters.expectedDuration}`, + ], + }, }; const headers = {