-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add DataCubePreview performance tests
- Loading branch information
1 parent
533fdbc
commit 96eb273
Showing
3 changed files
with
88 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import exec from "k6/execution"; | ||
import http from "k6/http"; | ||
|
||
const query = `query DataCubePreview( | ||
$iri: String! | ||
$sourceType: String! | ||
$sourceUrl: String! | ||
$locale: String! | ||
$latest: Boolean | ||
$disableValuesLoad: Boolean = true | ||
) { | ||
dataCubeByIri( | ||
iri: $iri | ||
sourceType: $sourceType | ||
sourceUrl: $sourceUrl | ||
locale: $locale | ||
latest: $latest | ||
disableValuesLoad: $disableValuesLoad | ||
) { | ||
iri | ||
title | ||
description | ||
publicationStatus | ||
observations( | ||
sourceType: $sourceType | ||
sourceUrl: $sourceUrl | ||
preview: true | ||
limit: 10 | ||
) { | ||
data | ||
sparqlEditorUrl | ||
} | ||
} | ||
}`; | ||
|
||
const env = __ENV.ENV; | ||
const cubeIri = __ENV.CUBE_IRI; | ||
const cubeLabel = __ENV.CUBE_LABEL; | ||
|
||
const variables = { | ||
iri: cubeIri, | ||
sourceType: "sparql", | ||
sourceUrl: `https://${env === "prod" ? "" : `${env}.`}lindas.admin.ch/query`, | ||
locale: "en", | ||
latest: false, | ||
}; | ||
|
||
/** @type {import("k6/options").Options} */ | ||
export const options = { | ||
iterations: 1, | ||
}; | ||
|
||
const headers = { | ||
"Content-Type": "application/json", | ||
"x-visualize-cache-control": "no-cache", | ||
}; | ||
|
||
export default function Components() { | ||
exec.vu.metrics.tags.env = env; | ||
exec.vu.metrics.tags.cube = cubeLabel; | ||
|
||
http.post( | ||
`https://${env === "prod" ? "" : `${env}.`}visualize.admin.ch/api/graphql`, | ||
JSON.stringify({ query, variables }), | ||
{ headers } | ||
); | ||
} |