Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions integrationTests/cluster/decodeDropRecovery.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ suite('Decode-drop recovery (harper-pro#537/#545)', { skip: !STRESS, timeout: 30
});

after(async () => {
// Guard against a before-hook that threw/skipped before either node was assigned —
// teardownHarper(undefined) would throw synchronously, which .catch() wouldn't reach.
if (ctx.nodeA) await teardownHarper(ctx.nodeA).catch(() => {});
if (ctx.nodeB) await teardownHarper(ctx.nodeB).catch(() => {});
// teardownHarper's argument must be a context: it early-returns on a falsy `ctx.harper`.
await Promise.all(
[ctx.nodeA, ctx.nodeB].filter(Boolean).map((node) => teardownHarper({ harper: node }).catch(() => {}))
);
Comment on lines +138 to +140

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

In test cleanup hooks, any failures during process termination or cleanup should be logged with identifying information (such as hostnames) for easier diagnosis, rather than being silently swallowed with an empty .catch(() => {}) block.

Suggested change
await Promise.all(
[ctx.nodeA, ctx.nodeB].filter(Boolean).map((node) => teardownHarper({ harper: node }).catch(() => {}))
);
await Promise.all(
[ctx.nodeA, ctx.nodeB].filter(Boolean).map((node) =>
teardownHarper({ harper: node }).catch((err) => {
console.error('Failed to teardown Harper node ' + (node.hostname || 'unknown') + ':', err);
})
)
);
References
  1. In test cleanup hooks, wrap individual process termination or cleanup steps in separate try-catch blocks to ensure they are attempted independently, and log any failures with identifying information (such as hostnames) for easier diagnosis.

});

test('B joins A, skips the undecodable records, and stays alive', async () => {
Expand All @@ -148,7 +148,7 @@ suite('Decode-drop recovery (harper-pro#537/#545)', { skip: !STRESS, timeout: 30
port: 9933,
isLeader: true,
rejectUnauthorized: false,
authorization: { username: ctx.nodeA.HDB_ADMIN_USERNAME, password: ctx.nodeA.HDB_ADMIN_PASSWORD },
authorization: ctx.nodeA.admin,
});

// (1) every clean row arrives — the leg is NOT starved behind the poison record.
Expand Down
Loading