From c14ce921ee32ec7431eaf90532d066d54892b318 Mon Sep 17 00:00:00 2001 From: Bartosz Prusinowski Date: Wed, 14 Feb 2024 16:23:08 +0100 Subject: [PATCH] chore: Define expected query durations to GQL performance tests --- k6/performance-tests/graphql/DataCubeComponents.js | 14 ++++++++++---- k6/performance-tests/graphql/DataCubeMetadata.js | 14 ++++++++++---- .../graphql/DataCubeObservations.js | 5 ++++- k6/performance-tests/graphql/DataCubePreview.js | 14 ++++++++++---- k6/performance-tests/graphql/PossibleFilters.js | 5 ++++- 5 files changed, 38 insertions(+), 14 deletions(-) diff --git a/k6/performance-tests/graphql/DataCubeComponents.js b/k6/performance-tests/graphql/DataCubeComponents.js index 812773524..6f255b2f0 100644 --- a/k6/performance-tests/graphql/DataCubeComponents.js +++ b/k6/performance-tests/graphql/DataCubeComponents.js @@ -1,4 +1,4 @@ -import { check, fail } from "k6"; +import { check } from "k6"; import exec from "k6/execution"; import http from "k6/http"; @@ -18,9 +18,15 @@ const query = `query DataCubeComponents( const metadataByCubeIri = { "https://energy.ld.admin.ch/sfoe/bfe_ogd84_einmalverguetung_fuer_photovoltaikanlagen/9": - {}, - "https://environment.ld.admin.ch/foen/nfi/nfi_C-20/cube/2023-3": {}, - "https://energy.ld.admin.ch/elcom/electricityprice": {}, + { + expectedQueryDuration: 750, + }, + "https://environment.ld.admin.ch/foen/nfi/nfi_C-20/cube/2023-3": { + expectedQueryDuration: 2000, + }, + "https://energy.ld.admin.ch/elcom/electricityprice": { + expectedQueryDuration: 10000, + }, }; const env = __ENV.ENV; diff --git a/k6/performance-tests/graphql/DataCubeMetadata.js b/k6/performance-tests/graphql/DataCubeMetadata.js index 0c92d5742..5e470978b 100644 --- a/k6/performance-tests/graphql/DataCubeMetadata.js +++ b/k6/performance-tests/graphql/DataCubeMetadata.js @@ -1,4 +1,4 @@ -import { check, fail } from "k6"; +import { check } from "k6"; import exec from "k6/execution"; import http from "k6/http"; @@ -18,9 +18,15 @@ const query = `query DataCubeMetadata( const metadataByCubeIri = { "https://energy.ld.admin.ch/sfoe/bfe_ogd84_einmalverguetung_fuer_photovoltaikanlagen/9": - {}, - "https://environment.ld.admin.ch/foen/nfi/nfi_C-20/cube/2023-3": {}, - "https://energy.ld.admin.ch/elcom/electricityprice": {}, + { + expectedQueryDuration: 250, + }, + "https://environment.ld.admin.ch/foen/nfi/nfi_C-20/cube/2023-3": { + expectedQueryDuration: 250, + }, + "https://energy.ld.admin.ch/elcom/electricityprice": { + expectedQueryDuration: 250, + }, }; const env = __ENV.ENV; diff --git a/k6/performance-tests/graphql/DataCubeObservations.js b/k6/performance-tests/graphql/DataCubeObservations.js index 968b2c657..e4f4f29a2 100644 --- a/k6/performance-tests/graphql/DataCubeObservations.js +++ b/k6/performance-tests/graphql/DataCubeObservations.js @@ -1,4 +1,4 @@ -import { check, fail } from "k6"; +import { check } from "k6"; import exec from "k6/execution"; import http from "k6/http"; @@ -29,6 +29,7 @@ const metadataByCubeIri = { }, }, }, + expectedQueryDuration: 500, }, "https://environment.ld.admin.ch/foen/nfi/nfi_C-20/cube/2023-3": { cubeFilter: { @@ -58,6 +59,7 @@ const metadataByCubeIri = { }, }, }, + expectedQueryDuration: 1500, }, "https://energy.ld.admin.ch/elcom/electricityprice": { cubeFilter: { @@ -87,6 +89,7 @@ const metadataByCubeIri = { }, }, }, + expectedQueryDuration: 4000, }, }; diff --git a/k6/performance-tests/graphql/DataCubePreview.js b/k6/performance-tests/graphql/DataCubePreview.js index 8cbbc8d79..61f074ad3 100644 --- a/k6/performance-tests/graphql/DataCubePreview.js +++ b/k6/performance-tests/graphql/DataCubePreview.js @@ -1,4 +1,4 @@ -import { check, fail } from "k6"; +import { check } from "k6"; import exec from "k6/execution"; import http from "k6/http"; @@ -18,9 +18,15 @@ const query = `query DataCubePreview( const metadataByCubeIri = { "https://energy.ld.admin.ch/sfoe/bfe_ogd84_einmalverguetung_fuer_photovoltaikanlagen/9": - {}, - "https://environment.ld.admin.ch/foen/nfi/nfi_C-20/cube/2023-3": {}, - "https://energy.ld.admin.ch/elcom/electricityprice": {}, + { + expectedQueryDuration: 1250, + }, + "https://environment.ld.admin.ch/foen/nfi/nfi_C-20/cube/2023-3": { + expectedQueryDuration: 1250, + }, + "https://energy.ld.admin.ch/elcom/electricityprice": { + expectedQueryDuration: 1250, + }, }; const env = __ENV.ENV; diff --git a/k6/performance-tests/graphql/PossibleFilters.js b/k6/performance-tests/graphql/PossibleFilters.js index eb7b7f61a..61fdbd4a1 100644 --- a/k6/performance-tests/graphql/PossibleFilters.js +++ b/k6/performance-tests/graphql/PossibleFilters.js @@ -1,4 +1,4 @@ -import { check, fail } from "k6"; +import { check } from "k6"; import exec from "k6/execution"; import http from "k6/http"; @@ -31,6 +31,7 @@ const metadataByCubeIri = { value: "https://ld.admin.ch/canton/1", }, }, + expectedQueryDuration: 600, }, "https://environment.ld.admin.ch/foen/nfi/nfi_C-20/cube/2023-3": { iri: "https://environment.ld.admin.ch/foen/nfi/nfi_C-20/cube/2023-3", @@ -57,6 +58,7 @@ const metadataByCubeIri = { value: "https://environment.ld.admin.ch/foen/nfi/EvaluationType/1", }, }, + expectedQueryDuration: 1500, }, "https://energy.ld.admin.ch/elcom/electricityprice": { iri: "https://energy.ld.admin.ch/elcom/electricityprice", @@ -80,6 +82,7 @@ const metadataByCubeIri = { "https://energy.ld.admin.ch/elcom/electricityprice/product/standard", }, }, + expectedQueryDuration: 3500, }, };