Skip to content

Commit

Permalink
refactor: Prepare for PR GQL regression tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bprusinowski committed Feb 15, 2024
1 parent b9fa67a commit 7c546cb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/performance-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: GraphQL performance tests
name: GraphQL performance tests (auto)

on:
workflow_dispatch:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,26 @@ const queries = [
"DataCubePreview",
"PossibleFilters",
];

const commands = envs
.flatMap((env) =>
queries.flatMap((query) =>
cubes.map((cube) => getRunCommand(env, query, cube))
cubes.map((cube) =>
getRunCommand(
env,
query,
cube,
`https://${
env === "prod" ? "" : `${env}.`
}visualize.admin.ch/api/graphql`
)
)
)
)
.join(" &&\n ");

const generate = () => {
const file = `name: GraphQL performance tests
const file = `name: GraphQL performance tests (auto)
on:
workflow_dispatch:
Expand Down Expand Up @@ -51,12 +61,6 @@ jobs:

generate();

function getRunCommand(env, query, cube) {
return `k6 run -o experimental-prometheus-rw --tag testid=${query} --env ENV=${env} --env ENDPOINT=${`https://${
env === "prod" ? "" : `${env}.`
}visualize.admin.ch/api/graphql`} --env CUBE_IRI=${
cube.iri
} --env CUBE_LABEL=${
cube.label
} - </root/k6/performance-tests/graphql/${query}.js`;
function getRunCommand(env, query, cube, endpoint) {
return `k6 run -o experimental-prometheus-rw --tag testid=${query} --env ENV=${env} --env ENDPOINT=${endpoint} --env CUBE_IRI=${cube.iri} --env CUBE_LABEL=${cube.label} - </root/k6/performance-tests/graphql/${query}.js`;
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"e2e": "percy exec -- playwright test",
"cube": "NODE_ENV=development ts-node app/scripts/cube.ts",
"dev:circular-deps": "madge --warning --extensions js,jsx,ts,tsx -b ./app -c ./app/pages/ --ts-config ./app/tsconfig.json | bun scripts/circular-deps-analysis.ts -",
"github:codegen": "node k6/performance-tests/generate-github-action.mjs"
"github:codegen": "node k6/performance-tests/generate-github-actions.mjs"
},
"dependencies": {
"@babel/runtime": "^7.11.2",
Expand Down

0 comments on commit 7c546cb

Please sign in to comment.