From 15c2303489915398d4564dc29a14b79aae781593 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 19 Jul 2023 10:34:21 +0200 Subject: [PATCH] More robust runner socket test --- server/tests/api/runners/runner-socket.ts | 32 ++++++++++++--------- server/tests/api/videos/video-storyboard.ts | 12 ++++---- 2 files changed, 24 insertions(+), 20 deletions(-) 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) + + // eslint-disable-next-line no-unmodified-loop-condition + while (pings !== 1) { + await wait(500) + } await server.videos.quickUpload({ name: 'video2' }) - - // 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) + } 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 () { diff --git a/server/tests/api/videos/video-storyboard.ts b/server/tests/api/videos/video-storyboard.ts index fc4b4450f..07f371cad 100644 --- a/server/tests/api/videos/video-storyboard.ts +++ b/server/tests/api/videos/video-storyboard.ts @@ -63,7 +63,7 @@ describe('Test video storyboard', function () { }) it('Should generate a storyboard after upload without transcoding', async function () { - this.timeout(60000) + this.timeout(120000) // 5s video const { uuid } = await servers[0].videos.quickUpload({ name: 'upload', fixture: 'video_short.webm' }) @@ -76,7 +76,7 @@ describe('Test video storyboard', function () { }) it('Should generate a storyboard after upload without transcoding with a long video', async function () { - this.timeout(60000) + this.timeout(120000) // 124s video const { uuid } = await servers[0].videos.quickUpload({ name: 'upload', fixture: 'video_very_long_10p.mp4' }) @@ -88,7 +88,7 @@ describe('Test video storyboard', function () { }) it('Should generate a storyboard after upload with transcoding', async function () { - this.timeout(60000) + this.timeout(120000) await servers[0].config.enableMinimumTranscoding() @@ -102,7 +102,7 @@ describe('Test video storyboard', function () { }) it('Should generate a storyboard after an audio upload', async function () { - this.timeout(60000) + this.timeout(120000) // 6s audio const attributes = { name: 'audio', fixture: 'sample.ogg' } @@ -119,7 +119,7 @@ describe('Test video storyboard', function () { }) it('Should generate a storyboard after HTTP import', async function () { - this.timeout(60000) + this.timeout(120000) if (areHttpImportTestsDisabled()) return @@ -139,7 +139,7 @@ describe('Test video storyboard', function () { }) it('Should generate a storyboard after torrent import', async function () { - this.timeout(60000) + this.timeout(120000) if (areHttpImportTestsDisabled()) return