1
0
Fork 0

Add test to ensure files are deleted

This commit is contained in:
Chocobozzz 2023-03-06 15:20:12 +01:00
parent f2dbbf6a96
commit b52f504848
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
1 changed files with 10 additions and 1 deletions

View File

@ -1,5 +1,6 @@
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import { join } from 'path'
import { areMockObjectStorageTestsDisabled } from '@shared/core-utils' import { areMockObjectStorageTestsDisabled } from '@shared/core-utils'
import { HttpStatusCode, VideoDetails } from '@shared/models' import { HttpStatusCode, VideoDetails } from '@shared/models'
import { import {
@ -12,7 +13,7 @@ import {
setAccessTokensToServers, setAccessTokensToServers,
waitJobs waitJobs
} from '@shared/server-commands' } from '@shared/server-commands'
import { expectStartWith } from '../shared' import { checkDirectoryIsEmpty, expectStartWith } from '../shared'
async function checkFiles (origin: PeerTubeServer, video: VideoDetails, inObjectStorage: boolean) { async function checkFiles (origin: PeerTubeServer, video: VideoDetails, inObjectStorage: boolean) {
for (const file of video.files) { for (const file of video.files) {
@ -106,6 +107,14 @@ describe('Test create move video storage job', function () {
} }
}) })
it('Should not have files on disk anymore', async function () {
await checkDirectoryIsEmpty(servers[0], 'videos', [ 'private' ])
await checkDirectoryIsEmpty(servers[0], join('videos', 'private'))
await checkDirectoryIsEmpty(servers[0], join('streaming-playlists', 'hls'), [ 'private' ])
await checkDirectoryIsEmpty(servers[0], join('streaming-playlists', 'hls', 'private'))
})
after(async function () { after(async function () {
await cleanupTests(servers) await cleanupTests(servers)
}) })