Skip to content

Commit

Permalink
chore(e2e): Fix sentinel dialog purge (#1546)
Browse files Browse the repository at this point in the history
Did not remove IDs that were successfully purged

#1547 

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Bug Fixes**
- Improved the logic for purging dialogs to ensure only failed purges
are retained for further inspection.
- Streamlined logging by removing unnecessary output upon purge failure.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
oskogstad authored Nov 29, 2024
1 parent e4b5069 commit 8fc34bf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/k6/common/sentinel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
}

Expand Down

0 comments on commit 8fc34bf

Please sign in to comment.