From da3a3ab6829107b3ed7f18dda42648dfde41871d Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 25 Apr 2019 09:46:02 +0200 Subject: Try parallel check params tests --- server/tests/api/search/search-activitypub-video-channels.ts | 2 +- server/tests/api/search/search-activitypub-videos.ts | 2 +- server/tests/api/search/search-videos.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'server/tests/api/search') diff --git a/server/tests/api/search/search-activitypub-video-channels.ts b/server/tests/api/search/search-activitypub-video-channels.ts index 4d1ceb767..70a077ffc 100644 --- a/server/tests/api/search/search-activitypub-video-channels.ts +++ b/server/tests/api/search/search-activitypub-video-channels.ts @@ -24,7 +24,7 @@ import { searchVideoChannel } from '../../../../shared/extra-utils/search/video- const expect = chai.expect -describe('Test a ActivityPub video channels search', function () { +describe('Test ActivityPub video channels search', function () { let servers: ServerInfo[] let userServer2Token: string let videoServer2UUID: string diff --git a/server/tests/api/search/search-activitypub-videos.ts b/server/tests/api/search/search-activitypub-videos.ts index e039961cb..e8e2b5a64 100644 --- a/server/tests/api/search/search-activitypub-videos.ts +++ b/server/tests/api/search/search-activitypub-videos.ts @@ -22,7 +22,7 @@ import { Video, VideoPrivacy } from '../../../../shared/models/videos' const expect = chai.expect -describe('Test a ActivityPub videos search', function () { +describe('Test ActivityPub videos search', function () { let servers: ServerInfo[] let videoServer1UUID: string let videoServer2UUID: string diff --git a/server/tests/api/search/search-videos.ts b/server/tests/api/search/search-videos.ts index 1a086b33a..22d3a5951 100644 --- a/server/tests/api/search/search-videos.ts +++ b/server/tests/api/search/search-videos.ts @@ -18,7 +18,7 @@ import { const expect = chai.expect -describe('Test a videos search', function () { +describe('Test videos search', function () { let server: ServerInfo = null let startDate: string -- cgit v1.2.3 From 7243f84db0f34c6d5610a54603b0cce7c284a7b3 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 25 Apr 2019 17:14:49 +0200 Subject: Redundancy and search tests in parallel too --- .../search/search-activitypub-video-channels.ts | 37 ++++++++++++---------- .../tests/api/search/search-activitypub-videos.ts | 29 ++++++++++------- server/tests/api/search/search-videos.ts | 8 ++--- 3 files changed, 40 insertions(+), 34 deletions(-) (limited to 'server/tests/api/search') diff --git a/server/tests/api/search/search-activitypub-video-channels.ts b/server/tests/api/search/search-activitypub-video-channels.ts index 70a077ffc..8a008b8c6 100644 --- a/server/tests/api/search/search-activitypub-video-channels.ts +++ b/server/tests/api/search/search-activitypub-video-channels.ts @@ -3,16 +3,17 @@ import * as chai from 'chai' import 'mocha' import { - addVideoChannel, cleanupTests, + addVideoChannel, + cleanupTests, createUser, deleteVideoChannel, flushAndRunMultipleServers, - flushTests, - getVideoChannelsList, getVideoChannelVideos, - killallServers, + getVideoChannelsList, + getVideoChannelVideos, ServerInfo, setAccessTokensToServers, - updateMyUser, updateVideo, + updateMyUser, + updateVideo, updateVideoChannel, uploadVideo, userLogin, @@ -67,7 +68,7 @@ describe('Test ActivityPub video channels search', function () { it('Should not find a remote video channel', async function () { { - const search = 'http://localhost:9002/video-channels/channel1_server3' + const search = 'http://localhost:' + servers[ 1 ].port + '/video-channels/channel1_server3' const res = await searchVideoChannel(servers[ 0 ].url, search, servers[ 0 ].accessToken) expect(res.body.total).to.equal(0) @@ -77,7 +78,7 @@ describe('Test ActivityPub video channels search', function () { { // Without token - const search = 'http://localhost:9002/video-channels/channel1_server2' + const search = 'http://localhost:' + servers[ 1 ].port + '/video-channels/channel1_server2' const res = await searchVideoChannel(servers[0].url, search) expect(res.body.total).to.equal(0) @@ -88,8 +89,8 @@ describe('Test ActivityPub video channels search', function () { it('Should search a local video channel', async function () { const searches = [ - 'http://localhost:9001/video-channels/channel1_server1', - 'channel1_server1@localhost:9001' + 'http://localhost:' + servers[ 0 ].port + '/video-channels/channel1_server1', + 'channel1_server1@localhost:' + servers[ 0 ].port ] for (const search of searches) { @@ -105,8 +106,8 @@ describe('Test ActivityPub video channels search', function () { it('Should search a remote video channel with URL or handle', async function () { const searches = [ - 'http://localhost:9002/video-channels/channel1_server2', - 'channel1_server2@localhost:9002' + 'http://localhost:' + servers[ 1 ].port + '/video-channels/channel1_server2', + 'channel1_server2@localhost:' + servers[ 1 ].port ] for (const search of searches) { @@ -134,13 +135,13 @@ describe('Test ActivityPub video channels search', function () { await waitJobs(servers) - const res = await getVideoChannelVideos(servers[0].url, null, 'channel1_server2@localhost:9002', 0, 5) + const res = await getVideoChannelVideos(servers[0].url, null, 'channel1_server2@localhost:' + servers[ 1 ].port, 0, 5) expect(res.body.total).to.equal(0) expect(res.body.data).to.have.lengthOf(0) }) it('Should list video channel videos of server 2 with token', async function () { - const res = await getVideoChannelVideos(servers[0].url, servers[0].accessToken, 'channel1_server2@localhost:9002', 0, 5) + const res = await getVideoChannelVideos(servers[0].url, servers[0].accessToken, 'channel1_server2@localhost:' + servers[ 1 ].port, 0, 5) expect(res.body.total).to.equal(1) expect(res.body.data[0].name).to.equal('video 1 server 2') @@ -156,7 +157,7 @@ describe('Test ActivityPub video channels search', function () { // Expire video channel await wait(10000) - const search = 'http://localhost:9002/video-channels/channel1_server2' + const search = 'http://localhost:' + servers[ 1 ].port + '/video-channels/channel1_server2' const res = await searchVideoChannel(servers[0].url, search, servers[0].accessToken) expect(res.body.total).to.equal(1) expect(res.body.data).to.have.lengthOf(1) @@ -179,12 +180,13 @@ describe('Test ActivityPub video channels search', function () { // Expire video channel await wait(10000) - const search = 'http://localhost:9002/video-channels/channel1_server2' + const search = 'http://localhost:' + servers[ 1 ].port + '/video-channels/channel1_server2' await searchVideoChannel(servers[0].url, search, servers[0].accessToken) await waitJobs(servers) - const res = await getVideoChannelVideos(servers[0].url, servers[0].accessToken, 'channel1_server2@localhost:9002', 0, 5, '-createdAt') + const videoChannelName = 'channel1_server2@localhost:' + servers[ 1 ].port + const res = await getVideoChannelVideos(servers[0].url, servers[0].accessToken, videoChannelName, 0, 5, '-createdAt') expect(res.body.total).to.equal(2) expect(res.body.data[0].name).to.equal('video 2 server 2') @@ -200,7 +202,8 @@ describe('Test ActivityPub video channels search', function () { // Expire video await wait(10000) - const res = await searchVideoChannel(servers[0].url, 'http://localhost:9002/video-channels/channel1_server2', servers[0].accessToken) + const search = 'http://localhost:' + servers[ 1 ].port + '/video-channels/channel1_server2' + const res = await searchVideoChannel(servers[0].url, search, servers[0].accessToken) expect(res.body.total).to.equal(0) expect(res.body.data).to.have.lengthOf(0) }) diff --git a/server/tests/api/search/search-activitypub-videos.ts b/server/tests/api/search/search-activitypub-videos.ts index e8e2b5a64..dbfefadda 100644 --- a/server/tests/api/search/search-activitypub-videos.ts +++ b/server/tests/api/search/search-activitypub-videos.ts @@ -4,18 +4,17 @@ import * as chai from 'chai' import 'mocha' import { addVideoChannel, + cleanupTests, flushAndRunMultipleServers, - flushTests, getVideosList, - killallServers, removeVideo, + searchVideo, searchVideoWithToken, ServerInfo, setAccessTokensToServers, updateVideo, uploadVideo, - wait, - searchVideo, cleanupTests + wait } from '../../../../shared/extra-utils' import { waitJobs } from '../../../../shared/extra-utils/server/jobs' import { Video, VideoPrivacy } from '../../../../shared/models/videos' @@ -49,7 +48,8 @@ describe('Test ActivityPub videos search', function () { it('Should not find a remote video', async function () { { - const res = await searchVideoWithToken(servers[ 0 ].url, 'http://localhost:9002/videos/watch/43', servers[ 0 ].accessToken) + const search = 'http://localhost:' + servers[1].port + '/videos/watch/43' + const res = await searchVideoWithToken(servers[ 0 ].url, search, servers[ 0 ].accessToken) expect(res.body.total).to.equal(0) expect(res.body.data).to.be.an('array') @@ -58,7 +58,8 @@ describe('Test ActivityPub videos search', function () { { // Without token - const res = await searchVideo(servers[0].url, 'http://localhost:9002/videos/watch/' + videoServer2UUID) + const search = 'http://localhost:' + servers[1].port + '/videos/watch/' + videoServer2UUID + const res = await searchVideo(servers[0].url, search) expect(res.body.total).to.equal(0) expect(res.body.data).to.be.an('array') @@ -67,7 +68,8 @@ describe('Test ActivityPub videos search', function () { }) it('Should search a local video', async function () { - const res = await searchVideo(servers[0].url, 'http://localhost:9001/videos/watch/' + videoServer1UUID) + const search = 'http://localhost:' + servers[0].port + '/videos/watch/' + videoServer1UUID + const res = await searchVideo(servers[0].url, search) expect(res.body.total).to.equal(1) expect(res.body.data).to.be.an('array') @@ -76,7 +78,8 @@ describe('Test ActivityPub videos search', function () { }) it('Should search a remote video', async function () { - const res = await searchVideoWithToken(servers[0].url, 'http://localhost:9002/videos/watch/' + videoServer2UUID, servers[0].accessToken) + const search = 'http://localhost:' + servers[1].port + '/videos/watch/' + videoServer2UUID + const res = await searchVideoWithToken(servers[0].url, search, servers[0].accessToken) expect(res.body.total).to.equal(1) expect(res.body.data).to.be.an('array') @@ -114,12 +117,13 @@ describe('Test ActivityPub videos search', function () { await wait(10000) // Will run refresh async - await searchVideoWithToken(servers[0].url, 'http://localhost:9002/videos/watch/' + videoServer2UUID, servers[0].accessToken) + const search = 'http://localhost:' + servers[1].port + '/videos/watch/' + videoServer2UUID + await searchVideoWithToken(servers[0].url, search, servers[0].accessToken) // Wait refresh await wait(5000) - const res = await searchVideoWithToken(servers[0].url, 'http://localhost:9002/videos/watch/' + videoServer2UUID, servers[0].accessToken) + const res = await searchVideoWithToken(servers[0].url, search, servers[0].accessToken) expect(res.body.total).to.equal(1) expect(res.body.data).to.have.lengthOf(1) @@ -139,12 +143,13 @@ describe('Test ActivityPub videos search', function () { await wait(10000) // Will run refresh async - await searchVideoWithToken(servers[0].url, 'http://localhost:9002/videos/watch/' + videoServer2UUID, servers[0].accessToken) + const search = 'http://localhost:' + servers[1].port + '/videos/watch/' + videoServer2UUID + await searchVideoWithToken(servers[0].url, search, servers[0].accessToken) // Wait refresh await wait(5000) - const res = await searchVideoWithToken(servers[0].url, 'http://localhost:9002/videos/watch/' + videoServer2UUID, servers[0].accessToken) + const res = await searchVideoWithToken(servers[0].url, search, servers[0].accessToken) expect(res.body.total).to.equal(0) expect(res.body.data).to.have.lengthOf(0) }) diff --git a/server/tests/api/search/search-videos.ts b/server/tests/api/search/search-videos.ts index 22d3a5951..92cc0dc71 100644 --- a/server/tests/api/search/search-videos.ts +++ b/server/tests/api/search/search-videos.ts @@ -4,16 +4,14 @@ import * as chai from 'chai' import 'mocha' import { advancedVideosSearch, - flushTests, - killallServers, + cleanupTests, flushAndRunServer, + immutableAssign, searchVideo, ServerInfo, setAccessTokensToServers, uploadVideo, - wait, - immutableAssign, - cleanupTests + wait } from '../../../../shared/extra-utils' const expect = chai.expect -- cgit v1.2.3