diff --git a/tests/k6/common/sentinel.js b/tests/k6/common/sentinel.js index 14054d676..2c2a7f732 100644 --- a/tests/k6/common/sentinel.js +++ b/tests/k6/common/sentinel.js @@ -27,13 +27,14 @@ export default function () { if (dialogIdsToPurge.length > 0) { console.error("Found " + dialogIdsToPurge.length + " unpurged dialogs, make sure that all tests clean up after themselves. Purging ..."); - dialogIdsToPurge.forEach((id) => { + dialogIdsToPurge = dialogIdsToPurge.filter((id) => { console.warn("Sentinel purging dialog with id: " + id) let r = purgeSO('dialogs/' + id, null, tokenOptions); if (r.status != 204) { console.error("Failed to purge dialog with id: " + id); - console.log(r); + return true; // Keep in the array if purge failed } + return false; // Remove from the array if purge succeeded }); }