From 7c3b79768bd174b22154e8d2df0b1211e01ee56a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 24 Apr 2019 15:10:37 +0200 Subject: Use test wrapper exit function --- server/tests/api/redundancy/redundancy.ts | 38 ++++++++++++++----------------- 1 file changed, 17 insertions(+), 21 deletions(-) (limited to 'server/tests/api/redundancy/redundancy.ts') diff --git a/server/tests/api/redundancy/redundancy.ts b/server/tests/api/redundancy/redundancy.ts index 280a4c64b..e31329c25 100644 --- a/server/tests/api/redundancy/redundancy.ts +++ b/server/tests/api/redundancy/redundancy.ts @@ -5,7 +5,7 @@ import 'mocha' import { VideoDetails } from '../../../../shared/models/videos' import { checkSegmentHash, - checkVideoFilesWereRemoved, + checkVideoFilesWereRemoved, cleanupTests, doubleFollow, flushAndRunMultipleServers, getFollowingListPaginationAndSort, @@ -52,7 +52,7 @@ function checkMagnetWebseeds (file: { magnetUri: string, resolution: { id: numbe expect(parsed.urlList).to.have.lengthOf(baseWebseeds.length) } -async function runServers (strategy: VideoRedundancyStrategy, additionalParams: any = {}) { +async function flushAndRunServers (strategy: VideoRedundancyStrategy, additionalParams: any = {}) { const config = { transcoding: { hls: { @@ -264,10 +264,6 @@ async function disableRedundancyOnServer1 () { expect(server2.following.hostRedundancyAllowed).to.be.false } -async function cleanServers () { - killallServers(servers) -} - describe('Test videos redundancy', function () { describe('With most-views strategy', function () { @@ -276,7 +272,7 @@ describe('Test videos redundancy', function () { before(function () { this.timeout(120000) - return runServers(strategy) + return flushAndRunServers(strategy) }) it('Should have 1 webseed on the first video', async function () { @@ -315,8 +311,8 @@ describe('Test videos redundancy', function () { await checkVideoFilesWereRemoved(video1Server2UUID, servers[0].serverNumber, [ 'videos', join('playlists', 'hls') ]) }) - after(function () { - return cleanServers() + after(async function () { + return cleanupTests(servers) }) }) @@ -326,7 +322,7 @@ describe('Test videos redundancy', function () { before(function () { this.timeout(120000) - return runServers(strategy) + return flushAndRunServers(strategy) }) it('Should have 1 webseed on the first video', async function () { @@ -365,8 +361,8 @@ describe('Test videos redundancy', function () { await checkVideoFilesWereRemoved(video1Server2UUID, servers[0].serverNumber, [ 'videos' ]) }) - after(function () { - return cleanServers() + after(async function () { + await cleanupTests(servers) }) }) @@ -376,7 +372,7 @@ describe('Test videos redundancy', function () { before(function () { this.timeout(120000) - return runServers(strategy, { min_views: 3 }) + return flushAndRunServers(strategy, { min_views: 3 }) }) it('Should have 1 webseed on the first video', async function () { @@ -435,8 +431,8 @@ describe('Test videos redundancy', function () { } }) - after(function () { - return cleanServers() + after(async function () { + await cleanupTests(servers) }) }) @@ -468,7 +464,7 @@ describe('Test videos redundancy', function () { before(async function () { this.timeout(120000) - await runServers(strategy, { min_lifetime: '7 seconds', min_views: 0 }) + await flushAndRunServers(strategy, { min_lifetime: '7 seconds', min_views: 0 }) await enableRedundancyOnServer1() }) @@ -498,8 +494,8 @@ describe('Test videos redundancy', function () { await checkNotContains([ servers[1], servers[2] ], 'http%3A%2F%2Flocalhost%3A9001') }) - after(function () { - return killallServers([ servers[1], servers[2] ]) + after(async function () { + await cleanupTests(servers) }) }) @@ -510,7 +506,7 @@ describe('Test videos redundancy', function () { before(async function () { this.timeout(120000) - await runServers(strategy, { min_lifetime: '7 seconds', min_views: 0 }) + await flushAndRunServers(strategy, { min_lifetime: '7 seconds', min_views: 0 }) await enableRedundancyOnServer1() @@ -569,8 +565,8 @@ describe('Test videos redundancy', function () { await checkVideoFilesWereRemoved(video1Server2UUID, servers[0].serverNumber, [ join('redundancy', 'hls') ]) }) - after(function () { - return cleanServers() + after(async function () { + await cleanupTests(servers) }) }) }) -- cgit v1.2.3