aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
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
parentbfd01f289dd9b7896fc94a1ee8ce2e0fbac1cf99 (diff)
downloadPeerTube-15c2303489915398d4564dc29a14b79aae781593.tar.gz
PeerTube-15c2303489915398d4564dc29a14b79aae781593.tar.zst
PeerTube-15c2303489915398d4564dc29a14b79aae781593.zip
More robust runner socket test
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/runners/runner-socket.ts32
-rw-r--r--server/tests/api/videos/video-storyboard.ts12
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 () {
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 () {
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 () {
63 }) 63 })
64 64
65 it('Should generate a storyboard after upload without transcoding', async function () { 65 it('Should generate a storyboard after upload without transcoding', async function () {
66 this.timeout(60000) 66 this.timeout(120000)
67 67
68 // 5s video 68 // 5s video
69 const { uuid } = await servers[0].videos.quickUpload({ name: 'upload', fixture: 'video_short.webm' }) 69 const { uuid } = await servers[0].videos.quickUpload({ name: 'upload', fixture: 'video_short.webm' })
@@ -76,7 +76,7 @@ describe('Test video storyboard', function () {
76 }) 76 })
77 77
78 it('Should generate a storyboard after upload without transcoding with a long video', async function () { 78 it('Should generate a storyboard after upload without transcoding with a long video', async function () {
79 this.timeout(60000) 79 this.timeout(120000)
80 80
81 // 124s video 81 // 124s video
82 const { uuid } = await servers[0].videos.quickUpload({ name: 'upload', fixture: 'video_very_long_10p.mp4' }) 82 const { uuid } = await servers[0].videos.quickUpload({ name: 'upload', fixture: 'video_very_long_10p.mp4' })
@@ -88,7 +88,7 @@ describe('Test video storyboard', function () {
88 }) 88 })
89 89
90 it('Should generate a storyboard after upload with transcoding', async function () { 90 it('Should generate a storyboard after upload with transcoding', async function () {
91 this.timeout(60000) 91 this.timeout(120000)
92 92
93 await servers[0].config.enableMinimumTranscoding() 93 await servers[0].config.enableMinimumTranscoding()
94 94
@@ -102,7 +102,7 @@ describe('Test video storyboard', function () {
102 }) 102 })
103 103
104 it('Should generate a storyboard after an audio upload', async function () { 104 it('Should generate a storyboard after an audio upload', async function () {
105 this.timeout(60000) 105 this.timeout(120000)
106 106
107 // 6s audio 107 // 6s audio
108 const attributes = { name: 'audio', fixture: 'sample.ogg' } 108 const attributes = { name: 'audio', fixture: 'sample.ogg' }
@@ -119,7 +119,7 @@ describe('Test video storyboard', function () {
119 }) 119 })
120 120
121 it('Should generate a storyboard after HTTP import', async function () { 121 it('Should generate a storyboard after HTTP import', async function () {
122 this.timeout(60000) 122 this.timeout(120000)
123 123
124 if (areHttpImportTestsDisabled()) return 124 if (areHttpImportTestsDisabled()) return
125 125
@@ -139,7 +139,7 @@ describe('Test video storyboard', function () {
139 }) 139 })
140 140
141 it('Should generate a storyboard after torrent import', async function () { 141 it('Should generate a storyboard after torrent import', async function () {
142 this.timeout(60000) 142 this.timeout(120000)
143 143
144 if (areHttpImportTestsDisabled()) return 144 if (areHttpImportTestsDisabled()) return
145 145