-
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 DataCubeComponents performance test
- Loading branch information
1 parent
13a2631
commit b0ff544
Showing
3 changed files
with
52 additions
and
2 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,50 @@ | ||
import exec from "k6/execution"; | ||
import http from "k6/http"; | ||
|
||
const query = `query DataCubeComponents( | ||
$sourceType: String! | ||
$sourceUrl: String! | ||
$locale: String! | ||
$cubeFilter: DataCubeComponentFilter! | ||
) { | ||
dataCubeComponents( | ||
sourceType: $sourceType | ||
sourceUrl: $sourceUrl | ||
locale: $locale | ||
cubeFilter: $cubeFilter | ||
) | ||
}`; | ||
|
||
const env = __ENV.ENV; | ||
const cubeIri = __ENV.CUBE_IRI; | ||
const cubeLabel = __ENV.CUBE_LABEL; | ||
|
||
const variables = { | ||
locale: "en", | ||
sourceType: "sparql", | ||
sourceUrl: `https://${env === "prod" ? "" : `${env}.`}lindas.admin.ch/query`, | ||
cubeFilter: { | ||
iri: cubeIri, | ||
}, | ||
}; | ||
|
||
/** @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 } | ||
); | ||
} |