diff options
author | Chocobozzz <me@florianbigard.com> | 2020-07-30 09:43:12 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2020-07-31 11:32:04 +0200 |
commit | b488ba1e26b803ac6c637e8b11bdd444ca4c803f (patch) | |
tree | 0a9ce01fcfb26ecddd8a0dccf997514818b8a72f /shared/extra-utils/miscs | |
parent | b9fe9a7ffdf80d81c5580ccccfeb989051fd9d8a (diff) | |
download | PeerTube-b488ba1e26b803ac6c637e8b11bdd444ca4c803f.tar.gz PeerTube-b488ba1e26b803ac6c637e8b11bdd444ca4c803f.tar.zst PeerTube-b488ba1e26b803ac6c637e8b11bdd444ca4c803f.zip |
Don't rely on youtube for tests
Use another import URL when possible, and disable import tests when we
want to do a youtube import test
Diffstat (limited to 'shared/extra-utils/miscs')
-rw-r--r-- | shared/extra-utils/miscs/miscs.ts | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/shared/extra-utils/miscs/miscs.ts b/shared/extra-utils/miscs/miscs.ts index 2239d5bcc..caf09c01f 100644 --- a/shared/extra-utils/miscs/miscs.ts +++ b/shared/extra-utils/miscs/miscs.ts | |||
@@ -64,19 +64,25 @@ async function testImage (url: string, imageName: string, imagePath: string, ext | |||
64 | } | 64 | } |
65 | 65 | ||
66 | function buildAbsoluteFixturePath (path: string, customCIPath = false) { | 66 | function buildAbsoluteFixturePath (path: string, customCIPath = false) { |
67 | if (isAbsolute(path)) { | 67 | if (isAbsolute(path)) return path |
68 | return path | ||
69 | } | ||
70 | 68 | ||
71 | if (customCIPath) { | 69 | if (customCIPath) { |
72 | if (process.env.GITLAB_CI) return join(root(), 'cached-fixtures', path) | 70 | if (process.env.GITLAB_CI) return join(root(), 'cached-fixtures', path) |
73 | 71 | ||
74 | if (process.env.TRAVIS) return join(process.env.HOME, 'fixtures', path) | 72 | return join(process.env.HOME, 'fixtures', path) |
75 | } | 73 | } |
76 | 74 | ||
77 | return join(root(), 'server', 'tests', 'fixtures', path) | 75 | return join(root(), 'server', 'tests', 'fixtures', path) |
78 | } | 76 | } |
79 | 77 | ||
78 | function areHttpImportTestsDisabled () { | ||
79 | const disabled = process.env.DISABLE_HTTP_IMPORT_TESTS === 'true' | ||
80 | |||
81 | if (disabled) console.log('Import tests are disabled') | ||
82 | |||
83 | return disabled | ||
84 | } | ||
85 | |||
80 | async function generateHighBitrateVideo () { | 86 | async function generateHighBitrateVideo () { |
81 | const tempFixturePath = buildAbsoluteFixturePath('video_high_bitrate_1080p.mp4', true) | 87 | const tempFixturePath = buildAbsoluteFixturePath('video_high_bitrate_1080p.mp4', true) |
82 | 88 | ||
@@ -131,6 +137,7 @@ async function generateVideoWithFramerate (fps = 60) { | |||
131 | export { | 137 | export { |
132 | dateIsValid, | 138 | dateIsValid, |
133 | wait, | 139 | wait, |
140 | areHttpImportTestsDisabled, | ||
134 | buildServerDirectory, | 141 | buildServerDirectory, |
135 | webtorrentAdd, | 142 | webtorrentAdd, |
136 | immutableAssign, | 143 | immutableAssign, |