import { sendCreateCacheFile, sendUpdateCacheFile } from '../activitypub/send'
import { VideoModel } from '../../models/video/video'
import { getVideoCacheFileActivityPubUrl } from '../activitypub/url'
-import { isTestInstance } from '../../helpers/core-utils'
import { removeVideoRedundancy } from '../redundancy'
export class VideosRedundancyScheduler extends AbstractScheduler {
raw: true,
attributes: [
[ Sequelize.fn('COALESCE', Sequelize.fn('SUM', Sequelize.col('VideoFile.size')), '0'), 'totalUsed' ],
- [ Sequelize.fn('COUNT', Sequelize.fn('DISTINCT', 'videoId')), 'totalVideos' ],
- [ Sequelize.fn('COUNT', 'videoFileId'), 'totalVideoFiles' ]
+ [ Sequelize.fn('COUNT', Sequelize.fn('DISTINCT', Sequelize.col('videoId'))), 'totalVideos' ],
+ [ Sequelize.fn('COUNT', Sequelize.col('videoFileId')), 'totalVideoFiles' ]
],
where: {
strategy,
getFollowingListPaginationAndSort,
getVideo,
immutableAssign,
- killallServers,
+ killallServers, makeGetRequest,
root,
ServerInfo,
setAccessTokensToServers,
}
}
- const files = await readdir(join(root(), 'test1', 'videos'))
- expect(files).to.have.lengthOf(4)
+ for (const url of [ 'http://localhost:9001', 'http://localhost:9002' ]) {
+ await makeGetRequest({
+ url,
+ statusCodeExpected: 200,
+ path: '/static/webseed/' + videoUUID,
+ contentType: null
+ })
+ }
- for (const resolution of [ 240, 360, 480, 720 ]) {
- expect(files.find(f => f === `${videoUUID}-${resolution}.mp4`)).to.not.be.undefined
+ for (const directory of [ 'test1', 'test2' ]) {
+ const files = await readdir(join(root(), directory, 'videos'))
+ expect(files).to.have.length.at.least(4)
+
+ for (const resolution of [ 240, 360, 480, 720 ]) {
+ expect(files.find(f => f === `${videoUUID}-${resolution}.mp4`)).to.not.be.undefined
+ }
}
}
path: string,
query?: any,
token?: string,
- statusCodeExpected?: number
+ statusCodeExpected?: number,
+ contentType?: string
}) {
if (!options.statusCodeExpected) options.statusCodeExpected = 400
+ if (options.contentType === undefined) options.contentType = 'application/json'
const req = request(options.url)
.get(options.path)
- .set('Accept', 'application/json')
+ if (options.contentType) req.set('Accept', options.contentType)
if (options.token) req.set('Authorization', 'Bearer ' + options.token)
if (options.query) req.query(options.query)
- return req
- .expect('Content-Type', /json/)
- .expect(options.statusCodeExpected)
+ return req.expect(options.statusCodeExpected)
}
function makeDeleteRequest (options: {