diff options
author | Chocobozzz <me@florianbigard.com> | 2023-03-07 10:42:31 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-03-07 10:42:31 +0100 |
commit | d9dbf27a7dacb42e49e21d5691141c2edf885644 (patch) | |
tree | 5f33a1125099b14f94d61091061d8b754a1e4784 /server | |
parent | 692ae8c31caa5a404142c9f46e03fdc8dc5b233f (diff) | |
parent | a3e5f7e732cca41267314d64307bdcfebd12e7de (diff) | |
download | PeerTube-d9dbf27a7dacb42e49e21d5691141c2edf885644.tar.gz PeerTube-d9dbf27a7dacb42e49e21d5691141c2edf885644.tar.zst PeerTube-d9dbf27a7dacb42e49e21d5691141c2edf885644.zip |
Merge branch 'release/5.1.0' into develop
Diffstat (limited to 'server')
-rw-r--r-- | server/models/user/user.ts | 4 | ||||
-rw-r--r-- | server/tests/cli/create-move-video-storage-job.ts | 11 |
2 files changed, 12 insertions, 3 deletions
diff --git a/server/models/user/user.ts b/server/models/user/user.ts index bfc9b3049..b6b120c92 100644 --- a/server/models/user/user.ts +++ b/server/models/user/user.ts | |||
@@ -781,12 +781,12 @@ export class UserModel extends Model<Partial<AttributesOnly<UserModel>>> { | |||
781 | `WHERE "account"."userId" = ${options.whereUserId} ${andWhere}` | 781 | `WHERE "account"."userId" = ${options.whereUserId} ${andWhere}` |
782 | 782 | ||
783 | const webtorrentFiles = 'SELECT "videoFile"."size" AS "size", "video"."id" AS "videoId" FROM "videoFile" ' + | 783 | const webtorrentFiles = 'SELECT "videoFile"."size" AS "size", "video"."id" AS "videoId" FROM "videoFile" ' + |
784 | 'INNER JOIN "video" ON "videoFile"."videoId" = "video"."id" ' + | 784 | 'INNER JOIN "video" ON "videoFile"."videoId" = "video"."id" AND "video"."isLive" IS FALSE ' + |
785 | videoChannelJoin | 785 | videoChannelJoin |
786 | 786 | ||
787 | const hlsFiles = 'SELECT "videoFile"."size" AS "size", "video"."id" AS "videoId" FROM "videoFile" ' + | 787 | const hlsFiles = 'SELECT "videoFile"."size" AS "size", "video"."id" AS "videoId" FROM "videoFile" ' + |
788 | 'INNER JOIN "videoStreamingPlaylist" ON "videoFile"."videoStreamingPlaylistId" = "videoStreamingPlaylist".id ' + | 788 | 'INNER JOIN "videoStreamingPlaylist" ON "videoFile"."videoStreamingPlaylistId" = "videoStreamingPlaylist".id ' + |
789 | 'INNER JOIN "video" ON "videoStreamingPlaylist"."videoId" = "video"."id" ' + | 789 | 'INNER JOIN "video" ON "videoStreamingPlaylist"."videoId" = "video"."id" AND "video"."isLive" IS FALSE ' + |
790 | videoChannelJoin | 790 | videoChannelJoin |
791 | 791 | ||
792 | return 'SELECT COALESCE(SUM("size"), 0) AS "total" ' + | 792 | return 'SELECT COALESCE(SUM("size"), 0) AS "total" ' + |
diff --git a/server/tests/cli/create-move-video-storage-job.ts b/server/tests/cli/create-move-video-storage-job.ts index c357f501b..4927e0309 100644 --- a/server/tests/cli/create-move-video-storage-job.ts +++ b/server/tests/cli/create-move-video-storage-job.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import { join } from 'path' | ||
3 | import { areMockObjectStorageTestsDisabled } from '@shared/core-utils' | 4 | import { areMockObjectStorageTestsDisabled } from '@shared/core-utils' |
4 | import { HttpStatusCode, VideoDetails } from '@shared/models' | 5 | import { HttpStatusCode, VideoDetails } from '@shared/models' |
5 | import { | 6 | import { |
@@ -12,7 +13,7 @@ import { | |||
12 | setAccessTokensToServers, | 13 | setAccessTokensToServers, |
13 | waitJobs | 14 | waitJobs |
14 | } from '@shared/server-commands' | 15 | } from '@shared/server-commands' |
15 | import { expectStartWith } from '../shared' | 16 | import { checkDirectoryIsEmpty, expectStartWith } from '../shared' |
16 | 17 | ||
17 | async function checkFiles (origin: PeerTubeServer, video: VideoDetails, inObjectStorage: boolean) { | 18 | async function checkFiles (origin: PeerTubeServer, video: VideoDetails, inObjectStorage: boolean) { |
18 | for (const file of video.files) { | 19 | for (const file of video.files) { |
@@ -106,6 +107,14 @@ describe('Test create move video storage job', function () { | |||
106 | } | 107 | } |
107 | }) | 108 | }) |
108 | 109 | ||
110 | it('Should not have files on disk anymore', async function () { | ||
111 | await checkDirectoryIsEmpty(servers[0], 'videos', [ 'private' ]) | ||
112 | await checkDirectoryIsEmpty(servers[0], join('videos', 'private')) | ||
113 | |||
114 | await checkDirectoryIsEmpty(servers[0], join('streaming-playlists', 'hls'), [ 'private' ]) | ||
115 | await checkDirectoryIsEmpty(servers[0], join('streaming-playlists', 'hls', 'private')) | ||
116 | }) | ||
117 | |||
109 | after(async function () { | 118 | after(async function () { |
110 | await cleanupTests(servers) | 119 | await cleanupTests(servers) |
111 | }) | 120 | }) |