cleanupTests,
CLICommand,
doubleFollow,
- flushAndRunMultipleServers,
+ createMultipleServers,
killallServers,
makeGetRequest,
- ServerInfo,
+ PeerTubeServer,
setAccessTokensToServers,
setDefaultVideoChannel,
wait,
const expect = chai.expect
-async function countFiles (server: ServerInfo, directory: string) {
- const files = await readdir(server.serversCommand.buildDirectory(directory))
+async function countFiles (server: PeerTubeServer, directory: string) {
+ const files = await readdir(server.servers.buildDirectory(directory))
return files.length
}
-async function assertNotExists (server: ServerInfo, directory: string, substring: string) {
- const files = await readdir(server.serversCommand.buildDirectory(directory))
+async function assertNotExists (server: PeerTubeServer, directory: string, substring: string) {
+ const files = await readdir(server.servers.buildDirectory(directory))
for (const f of files) {
expect(f).to.not.contain(substring)
}
}
-async function assertCountAreOkay (servers: ServerInfo[]) {
+async function assertCountAreOkay (servers: PeerTubeServer[]) {
for (const server of servers) {
const videosCount = await countFiles(server, 'videos')
expect(videosCount).to.equal(8)
}
describe('Test prune storage scripts', function () {
- let servers: ServerInfo[]
+ let servers: PeerTubeServer[]
const badNames: { [directory: string]: string[] } = {}
before(async function () {
this.timeout(120000)
- servers = await flushAndRunMultipleServers(2, { transcoding: { enabled: true } })
+ servers = await createMultipleServers(2, { transcoding: { enabled: true } })
await setAccessTokensToServers(servers)
await setDefaultVideoChannel(servers)
for (const server of servers) {
- await server.videosCommand.upload({ attributes: { name: 'video 1' } })
- await server.videosCommand.upload({ attributes: { name: 'video 2' } })
+ await server.videos.upload({ attributes: { name: 'video 1' } })
+ await server.videos.upload({ attributes: { name: 'video 2' } })
- await server.usersCommand.updateMyAvatar({ fixture: 'avatar.png' })
+ await server.users.updateMyAvatar({ fixture: 'avatar.png' })
- await server.playlistsCommand.create({
+ await server.playlists.create({
attributes: {
displayName: 'playlist',
privacy: VideoPlaylistPrivacy.PUBLIC,
- videoChannelId: server.videoChannel.id,
+ videoChannelId: server.store.channel.id,
thumbnailfile: 'thumbnail.jpg'
}
})
// Lazy load the remote avatar
{
- const account = await servers[0].accountsCommand.get({ accountName: 'root@localhost:' + servers[1].port })
+ const account = await servers[0].accounts.get({ accountName: 'root@localhost:' + servers[1].port })
await makeGetRequest({
url: servers[0].url,
path: account.avatar.path,
}
{
- const account = await servers[1].accountsCommand.get({ accountName: 'root@localhost:' + servers[0].port })
+ const account = await servers[1].accounts.get({ accountName: 'root@localhost:' + servers[0].port })
await makeGetRequest({
url: servers[1].url,
path: account.avatar.path,
it('Should create some dirty files', async function () {
for (let i = 0; i < 2; i++) {
{
- const base = servers[0].serversCommand.buildDirectory('videos')
+ const base = servers[0].servers.buildDirectory('videos')
const n1 = buildUUID() + '.mp4'
const n2 = buildUUID() + '.webm'
}
{
- const base = servers[0].serversCommand.buildDirectory('torrents')
+ const base = servers[0].servers.buildDirectory('torrents')
const n1 = buildUUID() + '-240.torrent'
const n2 = buildUUID() + '-480.torrent'
}
{
- const base = servers[0].serversCommand.buildDirectory('thumbnails')
+ const base = servers[0].servers.buildDirectory('thumbnails')
const n1 = buildUUID() + '.jpg'
const n2 = buildUUID() + '.jpg'
}
{
- const base = servers[0].serversCommand.buildDirectory('previews')
+ const base = servers[0].servers.buildDirectory('previews')
const n1 = buildUUID() + '.jpg'
const n2 = buildUUID() + '.jpg'
}
{
- const base = servers[0].serversCommand.buildDirectory('avatars')
+ const base = servers[0].servers.buildDirectory('avatars')
const n1 = buildUUID() + '.png'
const n2 = buildUUID() + '.jpg'
it('Should run prune storage', async function () {
this.timeout(30000)
- const env = servers[0].cliCommand.getEnv()
+ const env = servers[0].cli.getEnv()
await CLICommand.exec(`echo y | ${env} npm run prune-storage`)
})