X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fredundancy%2Fredundancy.ts;h=9887d25354a89d1101b7af428e40e40f020a2693;hb=0582b4f972a72c2297676faf1e574f817a5712f9;hp=b5929129a9676086ea46b432d66512cedfc4ffdc;hpb=fa66c9a601d69f6d57c956a3513e8bbed7ee9616;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/redundancy/redundancy.ts b/server/tests/api/redundancy/redundancy.ts index b5929129a..9887d2535 100644 --- a/server/tests/api/redundancy/redundancy.ts +++ b/server/tests/api/redundancy/redundancy.ts @@ -5,29 +5,26 @@ import * as chai from 'chai' import { readdir } from 'fs-extra' import magnetUtil from 'magnet-uri' import { basename, join } from 'path' +import { checkSegmentHash, checkVideoFilesWereRemoved, saveVideoInServers } from '@server/tests/shared' +import { root, wait } from '@shared/core-utils' +import { + HttpStatusCode, + VideoDetails, + VideoFile, + VideoPrivacy, + VideoRedundancyStrategy, + VideoRedundancyStrategyWithManual +} from '@shared/models' import { - checkSegmentHash, - checkVideoFilesWereRemoved, cleanupTests, createMultipleServers, doubleFollow, killallServers, makeRawRequest, PeerTubeServer, - root, - saveVideoInServers, setAccessTokensToServers, - wait, waitJobs -} from '@shared/extra-utils' -import { - HttpStatusCode, - VideoDetails, - VideoFile, - VideoPrivacy, - VideoRedundancyStrategy, - VideoRedundancyStrategyWithManual -} from '@shared/models' +} from '@shared/server-commands' const expect = chai.expect @@ -56,7 +53,7 @@ async function createServers (strategy: VideoRedundancyStrategy | null, addition strategies.push( { min_lifetime: '1 hour', - strategy: strategy, + strategy, size: '400KB', ...additionalParams @@ -90,7 +87,7 @@ async function createServers (strategy: VideoRedundancyStrategy | null, addition const { id } = await servers[1].videos.upload({ attributes: { name: 'video 1 server 2' } }) video1Server2 = await servers[1].videos.get({ id }) - await servers[1].videos.view({ id }) + await servers[1].views.simulateView({ id }) } await waitJobs(servers) @@ -450,8 +447,8 @@ describe('Test videos redundancy', function () { it('Should view 2 times the first video to have > min_views config', async function () { this.timeout(80000) - await servers[0].videos.view({ id: video1Server2.uuid }) - await servers[2].videos.view({ id: video1Server2.uuid }) + await servers[0].views.simulateView({ id: video1Server2.uuid }) + await servers[2].views.simulateView({ id: video1Server2.uuid }) await wait(10000) await waitJobs(servers) @@ -519,8 +516,8 @@ describe('Test videos redundancy', function () { it('Should have 1 redundancy on the first video', async function () { this.timeout(160000) - await servers[0].videos.view({ id: video1Server2.uuid }) - await servers[2].videos.view({ id: video1Server2.uuid }) + await servers[0].views.simulateView({ id: video1Server2.uuid }) + await servers[2].views.simulateView({ id: video1Server2.uuid }) await wait(10000) await waitJobs(servers)