Fix config test with parallel tests

This commit is contained in:
Chocobozzz 2024-03-28 10:03:47 +01:00
parent 81963e0c6e
commit 7eb0189b73
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 213 additions and 211 deletions

View File

@ -56,7 +56,7 @@ function checkInitialConfig (server: PeerTubeServer, data: CustomConfig) {
expect(data.signup.requiresApproval).to.be.false expect(data.signup.requiresApproval).to.be.false
expect(data.signup.requiresEmailVerification).to.be.false expect(data.signup.requiresEmailVerification).to.be.false
expect(data.admin.email).to.equal('admin' + server.internalServerNumber + '@example.com') expect(data.admin.email).to.equal(`admin${server.internalServerNumber}@example.com`)
expect(data.contactForm.enabled).to.be.true expect(data.contactForm.enabled).to.be.true
expect(data.user.history.videos.enabled).to.be.true expect(data.user.history.videos.enabled).to.be.true
@ -136,248 +136,250 @@ function checkInitialConfig (server: PeerTubeServer, data: CustomConfig) {
expect(data.export.users.maxUserVideoQuota).to.equal(10737418240) expect(data.export.users.maxUserVideoQuota).to.equal(10737418240)
} }
const newCustomConfig: CustomConfig = { function buildNewCustomConfig (server: PeerTubeServer): CustomConfig {
instance: { return {
name: 'PeerTube updated', instance: {
shortDescription: 'my short description', name: 'PeerTube updated',
description: 'my super description', shortDescription: 'my short description',
terms: 'my super terms', description: 'my super description',
codeOfConduct: 'my super coc', terms: 'my super terms',
codeOfConduct: 'my super coc',
creationReason: 'my super creation reason', creationReason: 'my super creation reason',
moderationInformation: 'my super moderation information', moderationInformation: 'my super moderation information',
administrator: 'Kuja', administrator: 'Kuja',
maintenanceLifetime: 'forever', maintenanceLifetime: 'forever',
businessModel: 'my super business model', businessModel: 'my super business model',
hardwareInformation: '2vCore 3GB RAM', hardwareInformation: '2vCore 3GB RAM',
languages: [ 'en', 'es' ], languages: [ 'en', 'es' ],
categories: [ 1, 2 ], categories: [ 1, 2 ],
isNSFW: true, isNSFW: true,
defaultNSFWPolicy: 'blur' as 'blur', defaultNSFWPolicy: 'blur' as 'blur',
defaultClientRoute: '/videos/recently-added', defaultClientRoute: '/videos/recently-added',
customizations: { customizations: {
javascript: 'alert("coucou")', javascript: 'alert("coucou")',
css: 'body { background-color: red; }' css: 'body { background-color: red; }'
}
},
theme: {
default: 'default'
},
services: {
twitter: {
username: '@Kuja'
}
},
client: {
videos: {
miniature: {
preferAuthorDisplayName: true
} }
}, },
menu: { theme: {
login: { default: 'default'
redirectOnSingleExternalAuth: true },
services: {
twitter: {
username: '@Kuja'
} }
}
},
cache: {
previews: {
size: 2
}, },
captions: { client: {
size: 3
},
torrents: {
size: 4
},
storyboards: {
size: 5
}
},
signup: {
enabled: false,
limit: 5,
requiresApproval: false,
requiresEmailVerification: false,
minimumAge: 10
},
admin: {
email: 'superadmin1@example.com'
},
contactForm: {
enabled: false
},
user: {
history: {
videos: { videos: {
enabled: false miniature: {
preferAuthorDisplayName: true
}
},
menu: {
login: {
redirectOnSingleExternalAuth: true
}
} }
}, },
videoQuota: 5242881, cache: {
videoQuotaDaily: 318742, previews: {
defaultChannelName: 'Main $1 channel' size: 2
}, },
videoChannels: { captions: {
maxPerUser: 24 size: 3
}, },
transcoding: { torrents: {
enabled: true, size: 4
remoteRunners: { },
enabled: true storyboards: {
size: 5
}
}, },
originalFile: { signup: {
keep: true enabled: false,
limit: 5,
requiresApproval: false,
requiresEmailVerification: false,
minimumAge: 10
}, },
allowAdditionalExtensions: true, admin: {
allowAudioFiles: true, email: `admin${server.internalServerNumber}@example.com`
threads: 1,
concurrency: 3,
profile: 'vod_profile',
resolutions: {
'0p': false,
'144p': false,
'240p': false,
'360p': true,
'480p': true,
'720p': false,
'1080p': false,
'1440p': false,
'2160p': false
}, },
alwaysTranscodeOriginalResolution: false, contactForm: {
webVideos: {
enabled: true
},
hls: {
enabled: false
}
},
live: {
enabled: true,
allowReplay: true,
latencySetting: {
enabled: false enabled: false
}, },
maxDuration: 5000, user: {
maxInstanceLives: -1, history: {
maxUserLives: 10, videos: {
enabled: false
}
},
videoQuota: 5242881,
videoQuotaDaily: 318742,
defaultChannelName: 'Main $1 channel'
},
videoChannels: {
maxPerUser: 24
},
transcoding: { transcoding: {
enabled: true, enabled: true,
remoteRunners: { remoteRunners: {
enabled: true enabled: true
}, },
threads: 4, originalFile: {
profile: 'live_profile', keep: true
},
allowAdditionalExtensions: true,
allowAudioFiles: true,
threads: 1,
concurrency: 3,
profile: 'vod_profile',
resolutions: { resolutions: {
'144p': true, '0p': false,
'240p': true, '144p': false,
'240p': false,
'360p': true, '360p': true,
'480p': true, '480p': true,
'720p': true, '720p': false,
'1080p': true, '1080p': false,
'1440p': true, '1440p': false,
'2160p': true '2160p': false
}, },
alwaysTranscodeOriginalResolution: false alwaysTranscodeOriginalResolution: false,
} webVideos: {
}, enabled: true
videoStudio: {
enabled: true,
remoteRunners: {
enabled: true
}
},
videoFile: {
update: {
enabled: true
}
},
import: {
videos: {
concurrency: 4,
http: {
enabled: false
}, },
torrent: { hls: {
enabled: false enabled: false
} }
}, },
videoChannelSynchronization: { live: {
enabled: false,
maxPerUser: 10
},
users: {
enabled: false
}
},
trending: {
videos: {
algorithms: {
enabled: [ 'hot', 'most-viewed', 'most-liked' ],
default: 'hot'
}
}
},
autoBlacklist: {
videos: {
ofUsers: {
enabled: true
}
}
},
followers: {
instance: {
enabled: false,
manualApproval: true
}
},
followings: {
instance: {
autoFollowBack: {
enabled: true
},
autoFollowIndex: {
enabled: true,
indexUrl: 'https://updated.example.com'
}
}
},
broadcastMessage: {
enabled: true,
level: 'error',
message: 'super bad message',
dismissable: true
},
search: {
remoteUri: {
anonymous: true,
users: true
},
searchIndex: {
enabled: true, enabled: true,
url: 'https://search.joinpeertube.org', allowReplay: true,
disableLocalSearch: true, latencySetting: {
isDefaultSearch: true enabled: false
} },
}, maxDuration: 5000,
storyboards: { maxInstanceLives: -1,
enabled: false maxUserLives: 10,
}, transcoding: {
export: { enabled: true,
users: { remoteRunners: {
enabled: false, enabled: true
exportExpiration: 43, },
maxUserVideoQuota: 42 threads: 4,
profile: 'live_profile',
resolutions: {
'144p': true,
'240p': true,
'360p': true,
'480p': true,
'720p': true,
'1080p': true,
'1440p': true,
'2160p': true
},
alwaysTranscodeOriginalResolution: false
}
},
videoStudio: {
enabled: true,
remoteRunners: {
enabled: true
}
},
videoFile: {
update: {
enabled: true
}
},
import: {
videos: {
concurrency: 4,
http: {
enabled: false
},
torrent: {
enabled: false
}
},
videoChannelSynchronization: {
enabled: false,
maxPerUser: 10
},
users: {
enabled: false
}
},
trending: {
videos: {
algorithms: {
enabled: [ 'hot', 'most-viewed', 'most-liked' ],
default: 'hot'
}
}
},
autoBlacklist: {
videos: {
ofUsers: {
enabled: true
}
}
},
followers: {
instance: {
enabled: false,
manualApproval: true
}
},
followings: {
instance: {
autoFollowBack: {
enabled: true
},
autoFollowIndex: {
enabled: true,
indexUrl: 'https://updated.example.com'
}
}
},
broadcastMessage: {
enabled: true,
level: 'error',
message: 'super bad message',
dismissable: true
},
search: {
remoteUri: {
anonymous: true,
users: true
},
searchIndex: {
enabled: true,
url: 'https://search.joinpeertube.org',
disableLocalSearch: true,
isDefaultSearch: true
}
},
storyboards: {
enabled: false
},
export: {
users: {
enabled: false,
exportExpiration: 43,
maxUserVideoQuota: 42
}
} }
} }
} }
describe('Test static config', function () { describe('Test static config', function () {
let server: PeerTubeServer = null let server: PeerTubeServer
before(async function () { before(async function () {
this.timeout(30000) this.timeout(30000)
@ -393,7 +395,7 @@ describe('Test static config', function () {
}) })
it('Should error when client tries to update', async function () { it('Should error when client tries to update', async function () {
await server.config.updateCustomConfig({ newCustomConfig, expectedStatus: 405 }) await server.config.updateCustomConfig({ newCustomConfig: buildNewCustomConfig(server), expectedStatus: 405 })
}) })
after(async function () { after(async function () {
@ -464,10 +466,10 @@ describe('Test config', function () {
}) })
it('Should update the customized configuration', async function () { it('Should update the customized configuration', async function () {
await server.config.updateCustomConfig({ newCustomConfig }) await server.config.updateCustomConfig({ newCustomConfig: buildNewCustomConfig(server) })
const data = await server.config.getCustomConfig() const data = await server.config.getCustomConfig()
expect(data).to.deep.equal(newCustomConfig) expect(data).to.deep.equal(buildNewCustomConfig(server))
}) })
it('Should have the correct updated video allowed extensions', async function () { it('Should have the correct updated video allowed extensions', async function () {
@ -499,7 +501,7 @@ describe('Test config', function () {
const data = await server.config.getCustomConfig() const data = await server.config.getCustomConfig()
expect(data).to.deep.equal(newCustomConfig) expect(data).to.deep.equal(buildNewCustomConfig(server))
}) })
it('Should fetch the about information', async function () { it('Should fetch the about information', async function () {