aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--.travis.yml5
-rw-r--r--server/tests/api/server/follows.ts2
-rw-r--r--server/tests/api/videos/multiple-servers.ts8
-rw-r--r--server/tests/utils/miscs/miscs.ts31
5 files changed, 20 insertions, 27 deletions
diff --git a/.gitignore b/.gitignore
index 5f6814019..75a8a2786 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,6 +15,7 @@
15/config/production.yaml 15/config/production.yaml
16/config/local* 16/config/local*
17/ffmpeg/ 17/ffmpeg/
18/ffmpeg-4/
18/thumbnails/ 19/thumbnails/
19/torrents/ 20/torrents/
20/videos/ 21/videos/
diff --git a/.travis.yml b/.travis.yml
index f9300f7ff..4cf90e818 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -26,12 +26,11 @@ install:
26 - CC=gcc-4.9 CXX=g++-4.9 yarn install 26 - CC=gcc-4.9 CXX=g++-4.9 yarn install
27 27
28before_script: 28before_script:
29 - wget --no-check-certificate "https://download.cpy.re/ffmpeg/ffmpeg-release-3.0.2-64bit-static.tar.xz" 29 - wget --no-check-certificate "https://download.cpy.re/ffmpeg/ffmpeg-release-4.0.2-64bit-static.tar.xz"
30 - tar xf ffmpeg-release-3.0.2-64bit-static.tar.xz 30 - tar xf ffmpeg-release-4.0.2-64bit-static.tar.xz
31 - mkdir -p $HOME/bin 31 - mkdir -p $HOME/bin
32 - cp ffmpeg-*-64bit-static/{ffmpeg,ffprobe,ffserver} $HOME/bin 32 - cp ffmpeg-*-64bit-static/{ffmpeg,ffprobe,ffserver} $HOME/bin
33 - export PATH=$HOME/bin:$PATH 33 - export PATH=$HOME/bin:$PATH
34 - export NODE_TEST_IMAGE=true
35 - psql -c "create user peertube with password 'peertube';" -U postgres 34 - psql -c "create user peertube with password 'peertube';" -U postgres
36 35
37matrix: 36matrix:
diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts
index 25c87b4dc..b91cb75c2 100644
--- a/server/tests/api/server/follows.ts
+++ b/server/tests/api/server/follows.ts
@@ -66,7 +66,7 @@ describe('Test follows', function () {
66 }) 66 })
67 67
68 it('Should have server 1 following server 2 and 3', async function () { 68 it('Should have server 1 following server 2 and 3', async function () {
69 this.timeout(10000) 69 this.timeout(30000)
70 70
71 await follow(servers[0].url, [ servers[1].url, servers[2].url ], servers[0].accessToken) 71 await follow(servers[0].url, [ servers[1].url, servers[2].url ], servers[0].accessToken)
72 72
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts
index 516dc5aba..58381a0e5 100644
--- a/server/tests/api/videos/multiple-servers.ts
+++ b/server/tests/api/videos/multiple-servers.ts
@@ -209,19 +209,19 @@ describe('Test multiple servers', function () {
209 files: [ 209 files: [
210 { 210 {
211 resolution: 240, 211 resolution: 240,
212 size: 280000 212 size: 342000
213 }, 213 },
214 { 214 {
215 resolution: 360, 215 resolution: 360,
216 size: 370000 216 size: 433000
217 }, 217 },
218 { 218 {
219 resolution: 480, 219 resolution: 480,
220 size: 470000 220 size: 538000
221 }, 221 },
222 { 222 {
223 resolution: 720, 223 resolution: 720,
224 size: 740000 224 size: 861000
225 } 225 }
226 ], 226 ],
227 thumbnailfile: 'thumbnail', 227 thumbnailfile: 'thumbnail',
diff --git a/server/tests/utils/miscs/miscs.ts b/server/tests/utils/miscs/miscs.ts
index 5e46004a7..b0667491b 100644
--- a/server/tests/utils/miscs/miscs.ts
+++ b/server/tests/utils/miscs/miscs.ts
@@ -37,25 +37,18 @@ function root () {
37} 37}
38 38
39async function testImage (url: string, imageName: string, imagePath: string, extension = '.jpg') { 39async function testImage (url: string, imageName: string, imagePath: string, extension = '.jpg') {
40 // Don't test images if the node env is not set 40 const res = await request(url)
41 // Because we need a special ffmpeg version for this test 41 .get(imagePath)
42 if (process.env[ 'NODE_TEST_IMAGE' ]) { 42 .expect(200)
43 const res = await request(url) 43
44 .get(imagePath) 44 const body = res.body
45 .expect(200) 45
46 46 const data = await readFileBufferPromise(join(__dirname, '..', '..', 'fixtures', imageName + extension))
47 const body = res.body 47 const minLength = body.length - ((20 * body.length) / 100)
48 48 const maxLength = body.length + ((20 * body.length) / 100)
49 const data = await readFileBufferPromise(join(__dirname, '..', '..', 'fixtures', imageName + extension)) 49
50 const minLength = body.length - ((20 * body.length) / 100) 50 expect(data.length).to.be.above(minLength)
51 const maxLength = body.length + ((20 * body.length) / 100) 51 expect(data.length).to.be.below(maxLength)
52
53 expect(data.length).to.be.above(minLength)
54 expect(data.length).to.be.below(maxLength)
55 } else {
56 console.log('Do not test images. Enable it by setting NODE_TEST_IMAGE env variable.')
57 return true
58 }
59} 52}
60 53
61function buildAbsoluteFixturePath (path: string) { 54function buildAbsoluteFixturePath (path: string) {