Skip to content

Commit

Permalink
Test: improve error logging in performance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ivard committed Oct 25, 2023
1 parent be5f600 commit 5484d91
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions testdata/performance/irma-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ export const options = {

function checkResponse(response, expectedOutput = '') {
const checkOutput = check(response, {
'verify response': (r) => r.error === '',
'verify status code': (r) => r.status === 200,
'verify body': (r) => r.body.includes(expectedOutput),
'verify body': (r) => r.body != null && r.body.includes(expectedOutput),
});
if (!checkOutput) fail(`unexpected response: status ${response.status}`);
if (!checkOutput) fail(`unexpected response: status ${response.status}, error "${response.error}", body "${response.body}"`);
}

export default function () {
Expand Down
6 changes: 4 additions & 2 deletions testdata/performance/keyshare-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ export const options = {

function checkResponse(response, expectedOutput = '') {
const checkOutput = check(response, {
'verify response': (r) => r.error === '',
'verify status code': (r) => r.status === 200,
'verify body': (r) => r.body.includes(expectedOutput),
'verify body': (r) => r.body != null && r.body.includes(expectedOutput),
});
if (!checkOutput) fail(`unexpected response: status ${response.status}`);
if (!checkOutput) fail(`unexpected response: status ${response.status}, error "${response.error}", body "${response.body}"`);
}

export function setup() {
Expand All @@ -41,6 +42,7 @@ export function setup() {
'Content-Type': 'application/json',
},
});
checkResponse(registerResp);

const sessionResp = http.get(registerResp.json().u, {
headers: {
Expand Down

0 comments on commit 5484d91

Please sign in to comment.