Fix running again object storage move job

This commit is contained in:
Chocobozzz
2026-05-29 10:26:22 +02:00
parent 9de18b4c13
commit d95195cf18
3 changed files with 21 additions and 3 deletions
@@ -16,6 +16,7 @@ import {
} from '@peertube/peertube-server-commands'
import { checkDirectoryIsEmpty } from '@tests/shared/directories.js'
import { completeCheckHlsPlaylist } from '@tests/shared/streaming-playlists.js'
import { expect } from 'chai'
import { join } from 'path'
import { expectStartWith } from '../shared/checks.js'
@@ -168,6 +169,15 @@ describe('Test create move video storage job CLI', function () {
}
})
it('Should not re-move all files', async function () {
const command = `npm run create-move-video-storage-job -- --to-object-storage --all-videos`
const { stdout } = await servers[0].cli.execWithEnv(command, objectStorage.getDefaultMockConfig())
expect(stdout).to.not.include('Creating external storage move job ')
await waitJobs(servers)
})
it('Should not have files on disk anymore', async function () {
await checkDirectoryIsEmpty(servers[0], 'captions', [ 'private' ])
@@ -232,6 +242,15 @@ describe('Test create move video storage job CLI', function () {
}
})
it('Should not re-move all files', async function () {
const command = `npm run create-move-video-storage-job -- --to-file-system --all-videos`
const { stdout } = await servers[0].cli.execWithEnv(command, objectStorage.getDefaultMockConfig())
expect(stdout).to.not.include('Creating external storage move job ')
await waitJobs(servers)
})
it('Should not have files on disk anymore', async function () {
for (const fileUrl of oldFileUrls) {
await makeRawRequest({ url: fileUrl, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
-1
View File
@@ -117,7 +117,6 @@ async function autoResize (options: {
}) {
const { sharpInstance, metadata, newSize, destination } = options
// Portrait/square input to landscape target
const sourceIsPortraitOrSquare = metadata.width <= metadata.height
const destIsPortraitOrSquare = newSize.width <= newSize.height
@@ -119,8 +119,8 @@ export async function filterVideoResourcesToBeMoved (videoArg: MVideo, targetSto
if (c.storage !== targetStorage) return true
if (hls) {
if (targetStorage === FileStorage.OBJECT_STORAGE) return !c.m3u8Filename || !c.m3u8Url
else if (targetStorage === FileStorage.FILE_SYSTEM) return !c.m3u8Filename || c.m3u8Url
if (targetStorage === FileStorage.OBJECT_STORAGE) return !c.m3u8Filename
else if (targetStorage === FileStorage.FILE_SYSTEM) return !c.m3u8Filename
}
return false