diff options
author | Chocobozzz <me@florianbigard.com> | 2018-08-10 17:49:12 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-08-10 17:49:12 +0200 |
commit | 288178bf02984c7e6dc69241918b88234a0dcb91 (patch) | |
tree | c0258c10aae2c650edd70a3f1588d95fdfd3b390 /server/tests | |
parent | 268eebed921ac13a9ce0f4717f4923aa24190657 (diff) | |
download | PeerTube-288178bf02984c7e6dc69241918b88234a0dcb91.tar.gz PeerTube-288178bf02984c7e6dc69241918b88234a0dcb91.tar.zst PeerTube-288178bf02984c7e6dc69241918b88234a0dcb91.zip |
Try to fix travis tests
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/api/server/follows.ts | 2 | ||||
-rw-r--r-- | server/tests/api/videos/multiple-servers.ts | 8 | ||||
-rw-r--r-- | server/tests/utils/miscs/miscs.ts | 31 |
3 files changed, 17 insertions, 24 deletions
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 | ||
39 | async function testImage (url: string, imageName: string, imagePath: string, extension = '.jpg') { | 39 | async 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 | ||
61 | function buildAbsoluteFixturePath (path: string) { | 54 | function buildAbsoluteFixturePath (path: string) { |