Skip to content

Commit

Permalink
chore: Add data correctness checks
Browse files Browse the repository at this point in the history
  • Loading branch information
bprusinowski committed Feb 14, 2024
1 parent 3ee8bc5 commit fae7727
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 15 deletions.
16 changes: 13 additions & 3 deletions k6/performance-tests/graphql/DataCubeComponents.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,17 @@ export default function Components() {
{ headers }
);

if (!check(res, { "Status code must be 200": (res) => res.status == 200 })) {
fail("Status code was *not* 200!");
}
check(res, {
"Response must have data": (res) => {
const body = res.json();
return (
body.data &&
body.data.dataCubeComponents &&
body.data.dataCubeComponents.dimensions &&
body.data.dataCubeComponents.dimensions.length > 0 &&
body.data.dataCubeComponents.measures &&
body.data.dataCubeComponents.measures.length > 0
);
},
});
}
13 changes: 10 additions & 3 deletions k6/performance-tests/graphql/DataCubeMetadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,14 @@ export default function Components() {
{ headers }
);

if (!check(res, { "Status code must be 200": (res) => res.status == 200 })) {
fail("Status code was *not* 200!");
}
check(res, {
"Response must have data": (res) => {
const body = res.json();
return (
body.data &&
body.data.dataCubeMetadata &&
body.data.dataCubeMetadata.iri === cubeIri
);
},
});
}
15 changes: 12 additions & 3 deletions k6/performance-tests/graphql/DataCubeObservations.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,16 @@ export default function Observations() {
{ headers }
);

if (!check(res, { "Status code must be 200": (res) => res.status == 200 })) {
fail("Status code was *not* 200!");
}
check(res, {
"Response must have data": (res) => {
const body = res.json();
return (
body.data &&
body.data.dataCubeObservations &&
body.data.dataCubeObservations &&
body.data.dataCubeObservations.data.length > 0 &&
body.data.dataCubeObservations.sparqlEditorUrl
);
},
});
}
18 changes: 15 additions & 3 deletions k6/performance-tests/graphql/DataCubePreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,19 @@ export default function Components() {
{ headers }
);

if (!check(res, { "Status code must be 200": (res) => res.status == 200 })) {
fail("Status code was *not* 200!");
}
check(res, {
"Response must have data": (res) => {
const body = res.json();
return (
body.data &&
body.data.dataCubePreview &&
body.data.dataCubePreview.dimensions &&
body.data.dataCubePreview.dimensions.length > 0 &&
body.data.dataCubePreview.measures &&
body.data.dataCubePreview.measures.length > 0 &&
body.data.dataCubePreview.observations &&
body.data.dataCubePreview.observations.length > 0
);
},
});
}
13 changes: 10 additions & 3 deletions k6/performance-tests/graphql/PossibleFilters.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,14 @@ export default function Observations() {
{ headers }
);

if (!check(res, { "Status code must be 200": (res) => res.status == 200 })) {
fail("Status code was *not* 200!");
}
check(res, {
"Response must have data": (res) => {
const body = res.json();
return (
body.data &&
body.data.possibleFilters &&
body.data.possibleFilters.length > 0
);
},
});
}

0 comments on commit fae7727

Please sign in to comment.