From 38f6bdaa7228a70fc15bf5cc57001d17000be4e4 Mon Sep 17 00:00:00 2001 From: Steve Larson <9larsons@gmail.com> Date: Tue, 12 Nov 2024 16:15:43 -0600 Subject: [PATCH] Fixed flaky batch sending tests (#21604) ref https://linear.app/ghost/issue/ENG-1749 Batch sending tests were failing with MySQL fairly regularly. It appears to be a race condition where the listener for the batch sending job having completed is returning too early, causing the subsequent Bookshelf data model refresh to happen too soon. This is a fundamental flaw in the JobManager awaitCompletion handler (and how the batch sending system interacts with it) as there's no way to identify one batch from another - they all use the same name, and we don't pass along any metadata. --- .../integration/services/email-service/batch-sending.test.js | 1 + 1 file changed, 1 insertion(+) diff --git a/ghost/core/test/integration/services/email-service/batch-sending.test.js b/ghost/core/test/integration/services/email-service/batch-sending.test.js index 8d0152e8a8..7b9ae1027b 100644 --- a/ghost/core/test/integration/services/email-service/batch-sending.test.js +++ b/ghost/core/test/integration/services/email-service/batch-sending.test.js @@ -109,6 +109,7 @@ describe('Batch sending tests', function () { value: false }], {context: {internal: true}}); mockManager.restore(); + await jobManager.allSettled(); }); before(async function () {