Fix tests

This commit is contained in:
Chocobozzz 2024-08-14 11:07:13 +02:00
parent be4bf80883
commit 7d52f17a35
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
3 changed files with 8 additions and 7 deletions

View File

@ -61,6 +61,7 @@ import { StatsCommand } from './stats-command.js'
import merge from 'lodash-es/merge.js' import merge from 'lodash-es/merge.js'
export type RunServerOptions = { export type RunServerOptions = {
autoEnableImportProxy?: boolean
hideLogs?: boolean hideLogs?: boolean
nodeArgs?: string[] nodeArgs?: string[]
peertubeArgs?: string[] peertubeArgs?: string[]
@ -241,7 +242,7 @@ export class PeerTubeServer {
await this.assignCustomConfigFile() await this.assignCustomConfigFile()
let configOverride = this.buildConfigOverride() let configOverride = this.buildConfigOverride(options)
if (configOverrideArg !== undefined) { if (configOverrideArg !== undefined) {
configOverride = merge(configOverride, configOverrideArg) configOverride = merge(configOverride, configOverrideArg)
@ -363,8 +364,8 @@ export class PeerTubeServer {
this.customConfigFile = tmpConfigFile this.customConfigFile = tmpConfigFile
} }
private buildConfigOverride () { private buildConfigOverride (options: RunServerOptions) {
const base = process.env.YOUTUBE_DL_PROXY const base = options.autoEnableImportProxy !== false && process.env.YOUTUBE_DL_PROXY
? { import: { videos: { http: { proxies: [ process.env.YOUTUBE_DL_PROXY ] } } } } ? { import: { videos: { http: { proxies: [ process.env.YOUTUBE_DL_PROXY ] } } } }
: {} : {}

View File

@ -114,7 +114,7 @@ describe('Test proxy', function () {
this.timeout(240000) this.timeout(240000)
await servers[0].kill() await servers[0].kill()
await servers[0].run(getProxyConfig(null), { env: goodEnv }) await servers[0].run({}, { env: goodEnv, autoEnableImportProxy: false })
await quickImport() await quickImport()
@ -129,7 +129,7 @@ describe('Test proxy', function () {
this.timeout(120000) this.timeout(120000)
await servers[0].kill() await servers[0].kill()
await servers[0].run(getProxyConfig(null), { env: badEnv }) await servers[0].run({}, { env: badEnv, autoEnableImportProxy: false })
await quickImport(HttpStatusCode.BAD_REQUEST_400) await quickImport(HttpStatusCode.BAD_REQUEST_400)
}) })
@ -138,7 +138,7 @@ describe('Test proxy', function () {
this.timeout(120000) this.timeout(120000)
await servers[0].kill() await servers[0].kill()
await servers[0].run(getProxyConfig('http://localhost:9000')) await servers[0].run(getProxyConfig('http://localhost:9000'), { autoEnableImportProxy: false })
await quickImport(HttpStatusCode.BAD_REQUEST_400) await quickImport(HttpStatusCode.BAD_REQUEST_400)
}) })

View File

@ -269,7 +269,7 @@ describe('Test VOD transcoding in peertube-runner program', function () {
describe('Web video only enabled', function () { describe('Web video only enabled', function () {
before(async function () { before(async function () {
await servers[0].config.enableTranscoding({ webVideo: true, hls: false, with0p: true }) await servers[0].config.enableTranscoding({ resolutions: 'max', webVideo: true, hls: false, with0p: true })
}) })
runSpecificSuite({ webVideoEnabled: true, hlsEnabled: false, objectStorage }) runSpecificSuite({ webVideoEnabled: true, hlsEnabled: false, objectStorage })