aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/miscs
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-07-29 11:59:29 +0200
committerChocobozzz <me@florianbigard.com>2019-07-29 13:40:39 +0200
commit2284f202070aa2e49156cc52b3b1596a7d5aadec (patch)
tree77aeb00016734667f8ff32a98ea8b4a6ed3ca31e /shared/extra-utils/miscs
parent112be80ebdf96ef6a27420c1c6a10097388731a9 (diff)
downloadPeerTube-2284f202070aa2e49156cc52b3b1596a7d5aadec.tar.gz
PeerTube-2284f202070aa2e49156cc52b3b1596a7d5aadec.tar.zst
PeerTube-2284f202070aa2e49156cc52b3b1596a7d5aadec.zip
Add gitlab ci support
Diffstat (limited to 'shared/extra-utils/miscs')
-rw-r--r--shared/extra-utils/miscs/miscs.ts10
-rw-r--r--shared/extra-utils/miscs/sql.ts3
2 files changed, 7 insertions, 6 deletions
diff --git a/shared/extra-utils/miscs/miscs.ts b/shared/extra-utils/miscs/miscs.ts
index 42250886c..08f41a7e7 100644
--- a/shared/extra-utils/miscs/miscs.ts
+++ b/shared/extra-utils/miscs/miscs.ts
@@ -1,10 +1,10 @@
1/* tslint:disable:no-unused-expression */ 1/* tslint:disable:no-unused-expression */
2 2
3import * as chai from 'chai' 3import * as chai from 'chai'
4import { basename, isAbsolute, join, resolve } from 'path' 4import { basename, dirname, isAbsolute, join, resolve } from 'path'
5import * as request from 'supertest' 5import * as request from 'supertest'
6import * as WebTorrent from 'webtorrent' 6import * as WebTorrent from 'webtorrent'
7import { pathExists, readFile } from 'fs-extra' 7import { ensureDir, pathExists, readFile } from 'fs-extra'
8import * as ffmpeg from 'fluent-ffmpeg' 8import * as ffmpeg from 'fluent-ffmpeg'
9 9
10const expect = chai.expect 10const expect = chai.expect
@@ -59,12 +59,12 @@ async function testImage (url: string, imageName: string, imagePath: string, ext
59 expect(data.length).to.be.below(maxLength) 59 expect(data.length).to.be.below(maxLength)
60} 60}
61 61
62function buildAbsoluteFixturePath (path: string, customTravisPath = false) { 62function buildAbsoluteFixturePath (path: string, customCIPath = false) {
63 if (isAbsolute(path)) { 63 if (isAbsolute(path)) {
64 return path 64 return path
65 } 65 }
66 66
67 if (customTravisPath && process.env.TRAVIS) return join(process.env.HOME, 'fixtures', path) 67 if (customCIPath && process.env.GITLAB_CI) return join(root(), 'cached-fixtures', path)
68 68
69 return join(root(), 'server', 'tests', 'fixtures', path) 69 return join(root(), 'server', 'tests', 'fixtures', path)
70} 70}
@@ -72,6 +72,8 @@ function buildAbsoluteFixturePath (path: string, customTravisPath = false) {
72async function generateHighBitrateVideo () { 72async function generateHighBitrateVideo () {
73 const tempFixturePath = buildAbsoluteFixturePath('video_high_bitrate_1080p.mp4', true) 73 const tempFixturePath = buildAbsoluteFixturePath('video_high_bitrate_1080p.mp4', true)
74 74
75 await ensureDir(dirname(tempFixturePath))
76
75 const exists = await pathExists(tempFixturePath) 77 const exists = await pathExists(tempFixturePath)
76 if (!exists) { 78 if (!exists) {
77 79
diff --git a/shared/extra-utils/miscs/sql.ts b/shared/extra-utils/miscs/sql.ts
index 1961a8762..dfe840d8c 100644
--- a/shared/extra-utils/miscs/sql.ts
+++ b/shared/extra-utils/miscs/sql.ts
@@ -1,6 +1,5 @@
1import { QueryTypes, Sequelize } from 'sequelize' 1import { QueryTypes, Sequelize } from 'sequelize'
2import { ServerInfo } from '../server/servers' 2import { ServerInfo } from '../server/servers'
3import { PluginType } from '../../models/plugins/plugin.type'
4 3
5let sequelizes: { [ id: number ]: Sequelize } = {} 4let sequelizes: { [ id: number ]: Sequelize } = {}
6 5
@@ -10,7 +9,7 @@ function getSequelize (internalServerNumber: number) {
10 const dbname = 'peertube_test' + internalServerNumber 9 const dbname = 'peertube_test' + internalServerNumber
11 const username = 'peertube' 10 const username = 'peertube'
12 const password = 'peertube' 11 const password = 'peertube'
13 const host = 'localhost' 12 const host = process.env.GITLAB_CI ? 'postgres' : 'localhost'
14 const port = 5432 13 const port = 5432
15 14
16 const seq = new Sequelize(dbname, username, password, { 15 const seq = new Sequelize(dbname, username, password, {