aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/runners/runner-socket.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-07-19 10:34:21 +0200
committerChocobozzz <me@florianbigard.com>2023-07-19 10:43:12 +0200
commit15c2303489915398d4564dc29a14b79aae781593 (patch)
tree6580f43f1c40307b2c8b452b802dd7c8be2fdac8 /server/tests/api/runners/runner-socket.ts
parentbfd01f289dd9b7896fc94a1ee8ce2e0fbac1cf99 (diff)
downloadPeerTube-15c2303489915398d4564dc29a14b79aae781593.tar.gz
PeerTube-15c2303489915398d4564dc29a14b79aae781593.tar.zst
PeerTube-15c2303489915398d4564dc29a14b79aae781593.zip
More robust runner socket test
Diffstat (limited to 'server/tests/api/runners/runner-socket.ts')
-rw-r--r--server/tests/api/runners/runner-socket.ts32
1 files changed, 18 insertions, 14 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 () {
58 localSocket.on('available-jobs', () => pings++) 58 localSocket.on('available-jobs', () => pings++)
59 59
60 await server.videos.quickUpload({ name: 'video1' }) 60 await server.videos.quickUpload({ name: 'video1' })
61
62 // Wait for debounce
63 await wait(1000)
64 await waitJobs([ server ]) 61 await waitJobs([ server ])
65 expect(pings).to.equal(1)
66 62
67 await server.videos.quickUpload({ name: 'video2' }) 63 // eslint-disable-next-line no-unmodified-loop-condition
64 while (pings !== 1) {
65 await wait(500)
66 }
68 67
69 // Wait for debounce 68 await server.videos.quickUpload({ name: 'video2' })
70 await wait(1000)
71 await waitJobs([ server ]) 69 await waitJobs([ server ])
72 expect(pings).to.equal(2) 70
71 // eslint-disable-next-line no-unmodified-loop-condition
72 while ((pings as number) !== 2) {
73 await wait(500)
74 }
73 75
74 await server.runnerJobs.cancelAllJobs() 76 await server.runnerJobs.cancelAllJobs()
75 }) 77 })
@@ -80,18 +82,20 @@ describe('Test runner socket', function () {
80 localSocket.on('available-jobs', () => pings++) 82 localSocket.on('available-jobs', () => pings++)
81 83
82 await server.videos.quickUpload({ name: 'video3' }) 84 await server.videos.quickUpload({ name: 'video3' })
83 // Wait for debounce
84 await wait(1000)
85 await waitJobs([ server ]) 85 await waitJobs([ server ])
86 86
87 expect(pings).to.equal(1) 87 // eslint-disable-next-line no-unmodified-loop-condition
88 while (pings !== 1) {
89 await wait(500)
90 }
88 91
89 await server.runnerJobs.autoProcessWebVideoJob(runnerToken) 92 await server.runnerJobs.autoProcessWebVideoJob(runnerToken)
90 // Wait for debounce
91 await wait(1000)
92 await waitJobs([ server ]) 93 await waitJobs([ server ])
93 94
94 expect(pings).to.equal(2) 95 // eslint-disable-next-line no-unmodified-loop-condition
96 while ((pings as number) !== 2) {
97 await wait(500)
98 }
95 }) 99 })
96 100
97 it('Should not send a ping if the ended job does not have a child', async function () { 101 it('Should not send a ping if the ended job does not have a child', async function () {