From 5484d91cbb063ab6a6cdfc31f23968facbbdb905 Mon Sep 17 00:00:00 2001 From: Ivar Derksen Date: Wed, 25 Oct 2023 11:05:34 +0200 Subject: [PATCH] Test: improve error logging in performance tests --- testdata/performance/irma-server.js | 5 +++-- testdata/performance/keyshare-server.js | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/testdata/performance/irma-server.js b/testdata/performance/irma-server.js index 742374ed..3c4b997a 100644 --- a/testdata/performance/irma-server.js +++ b/testdata/performance/irma-server.js @@ -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 () { diff --git a/testdata/performance/keyshare-server.js b/testdata/performance/keyshare-server.js index e349ea6e..5c84e3a3 100644 --- a/testdata/performance/keyshare-server.js +++ b/testdata/performance/keyshare-server.js @@ -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() { @@ -41,6 +42,7 @@ export function setup() { 'Content-Type': 'application/json', }, }); + checkResponse(registerResp); const sessionResp = http.get(registerResp.json().u, { headers: {