From 15c2303489915398d4564dc29a14b79aae781593 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 19 Jul 2023 10:34:21 +0200 Subject: More robust runner socket test --- server/tests/api/runners/runner-socket.ts | 32 +++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'server/tests/api/runners') diff --git a/server/tests/api/runners/runner-socket.ts b/server/tests/api/runners/runner-socket.ts index df640f99c..a77e57a11 100644 --- a/server/tests/api/runners/runner-socket.ts +++ b/server/tests/api/runners/runner-socket.ts @@ -58,18 +58,20 @@ describe('Test runner socket', function () { localSocket.on('available-jobs', () => pings++) await server.videos.quickUpload({ name: 'video1' }) - - // Wait for debounce - await wait(1000) await waitJobs([ server ]) - expect(pings).to.equal(1) - await server.videos.quickUpload({ name: 'video2' }) + // eslint-disable-next-line no-unmodified-loop-condition + while (pings !== 1) { + await wait(500) + } - // Wait for debounce - await wait(1000) + await server.videos.quickUpload({ name: 'video2' }) await waitJobs([ server ]) - expect(pings).to.equal(2) + + // eslint-disable-next-line no-unmodified-loop-condition + while ((pings as number) !== 2) { + await wait(500) + } await server.runnerJobs.cancelAllJobs() }) @@ -80,18 +82,20 @@ describe('Test runner socket', function () { localSocket.on('available-jobs', () => pings++) await server.videos.quickUpload({ name: 'video3' }) - // Wait for debounce - await wait(1000) await waitJobs([ server ]) - expect(pings).to.equal(1) + // eslint-disable-next-line no-unmodified-loop-condition + while (pings !== 1) { + await wait(500) + } await server.runnerJobs.autoProcessWebVideoJob(runnerToken) - // Wait for debounce - await wait(1000) await waitJobs([ server ]) - expect(pings).to.equal(2) + // eslint-disable-next-line no-unmodified-loop-condition + while ((pings as number) !== 2) { + await wait(500) + } }) it('Should not send a ping if the ended job does not have a child', async function () { -- cgit v1.2.3