aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/search/search-activitypub-video-channels.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-04-25 17:14:49 +0200
committerChocobozzz <me@florianbigard.com>2019-05-14 15:37:43 +0200
commit7243f84db0f34c6d5610a54603b0cce7c284a7b3 (patch)
treec913e9342ec83098bf30c1debd609a15318bc0fb /server/tests/api/search/search-activitypub-video-channels.ts
parentda3a3ab6829107b3ed7f18dda42648dfde41871d (diff)
downloadPeerTube-7243f84db0f34c6d5610a54603b0cce7c284a7b3.tar.gz
PeerTube-7243f84db0f34c6d5610a54603b0cce7c284a7b3.tar.zst
PeerTube-7243f84db0f34c6d5610a54603b0cce7c284a7b3.zip
Redundancy and search tests in parallel too
Diffstat (limited to 'server/tests/api/search/search-activitypub-video-channels.ts')
-rw-r--r--server/tests/api/search/search-activitypub-video-channels.ts37
1 files changed, 20 insertions, 17 deletions
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 @@
3import * as chai from 'chai' 3import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { 5import {
6 addVideoChannel, cleanupTests, 6 addVideoChannel,
7 cleanupTests,
7 createUser, 8 createUser,
8 deleteVideoChannel, 9 deleteVideoChannel,
9 flushAndRunMultipleServers, 10 flushAndRunMultipleServers,
10 flushTests, 11 getVideoChannelsList,
11 getVideoChannelsList, getVideoChannelVideos, 12 getVideoChannelVideos,
12 killallServers,
13 ServerInfo, 13 ServerInfo,
14 setAccessTokensToServers, 14 setAccessTokensToServers,
15 updateMyUser, updateVideo, 15 updateMyUser,
16 updateVideo,
16 updateVideoChannel, 17 updateVideoChannel,
17 uploadVideo, 18 uploadVideo,
18 userLogin, 19 userLogin,
@@ -67,7 +68,7 @@ describe('Test ActivityPub video channels search', function () {
67 68
68 it('Should not find a remote video channel', async function () { 69 it('Should not find a remote video channel', async function () {
69 { 70 {
70 const search = 'http://localhost:9002/video-channels/channel1_server3' 71 const search = 'http://localhost:' + servers[ 1 ].port + '/video-channels/channel1_server3'
71 const res = await searchVideoChannel(servers[ 0 ].url, search, servers[ 0 ].accessToken) 72 const res = await searchVideoChannel(servers[ 0 ].url, search, servers[ 0 ].accessToken)
72 73
73 expect(res.body.total).to.equal(0) 74 expect(res.body.total).to.equal(0)
@@ -77,7 +78,7 @@ describe('Test ActivityPub video channels search', function () {
77 78
78 { 79 {
79 // Without token 80 // Without token
80 const search = 'http://localhost:9002/video-channels/channel1_server2' 81 const search = 'http://localhost:' + servers[ 1 ].port + '/video-channels/channel1_server2'
81 const res = await searchVideoChannel(servers[0].url, search) 82 const res = await searchVideoChannel(servers[0].url, search)
82 83
83 expect(res.body.total).to.equal(0) 84 expect(res.body.total).to.equal(0)
@@ -88,8 +89,8 @@ describe('Test ActivityPub video channels search', function () {
88 89
89 it('Should search a local video channel', async function () { 90 it('Should search a local video channel', async function () {
90 const searches = [ 91 const searches = [
91 'http://localhost:9001/video-channels/channel1_server1', 92 'http://localhost:' + servers[ 0 ].port + '/video-channels/channel1_server1',
92 'channel1_server1@localhost:9001' 93 'channel1_server1@localhost:' + servers[ 0 ].port
93 ] 94 ]
94 95
95 for (const search of searches) { 96 for (const search of searches) {
@@ -105,8 +106,8 @@ describe('Test ActivityPub video channels search', function () {
105 106
106 it('Should search a remote video channel with URL or handle', async function () { 107 it('Should search a remote video channel with URL or handle', async function () {
107 const searches = [ 108 const searches = [
108 'http://localhost:9002/video-channels/channel1_server2', 109 'http://localhost:' + servers[ 1 ].port + '/video-channels/channel1_server2',
109 'channel1_server2@localhost:9002' 110 'channel1_server2@localhost:' + servers[ 1 ].port
110 ] 111 ]
111 112
112 for (const search of searches) { 113 for (const search of searches) {
@@ -134,13 +135,13 @@ describe('Test ActivityPub video channels search', function () {
134 135
135 await waitJobs(servers) 136 await waitJobs(servers)
136 137
137 const res = await getVideoChannelVideos(servers[0].url, null, 'channel1_server2@localhost:9002', 0, 5) 138 const res = await getVideoChannelVideos(servers[0].url, null, 'channel1_server2@localhost:' + servers[ 1 ].port, 0, 5)
138 expect(res.body.total).to.equal(0) 139 expect(res.body.total).to.equal(0)
139 expect(res.body.data).to.have.lengthOf(0) 140 expect(res.body.data).to.have.lengthOf(0)
140 }) 141 })
141 142
142 it('Should list video channel videos of server 2 with token', async function () { 143 it('Should list video channel videos of server 2 with token', async function () {
143 const res = await getVideoChannelVideos(servers[0].url, servers[0].accessToken, 'channel1_server2@localhost:9002', 0, 5) 144 const res = await getVideoChannelVideos(servers[0].url, servers[0].accessToken, 'channel1_server2@localhost:' + servers[ 1 ].port, 0, 5)
144 145
145 expect(res.body.total).to.equal(1) 146 expect(res.body.total).to.equal(1)
146 expect(res.body.data[0].name).to.equal('video 1 server 2') 147 expect(res.body.data[0].name).to.equal('video 1 server 2')
@@ -156,7 +157,7 @@ describe('Test ActivityPub video channels search', function () {
156 // Expire video channel 157 // Expire video channel
157 await wait(10000) 158 await wait(10000)
158 159
159 const search = 'http://localhost:9002/video-channels/channel1_server2' 160 const search = 'http://localhost:' + servers[ 1 ].port + '/video-channels/channel1_server2'
160 const res = await searchVideoChannel(servers[0].url, search, servers[0].accessToken) 161 const res = await searchVideoChannel(servers[0].url, search, servers[0].accessToken)
161 expect(res.body.total).to.equal(1) 162 expect(res.body.total).to.equal(1)
162 expect(res.body.data).to.have.lengthOf(1) 163 expect(res.body.data).to.have.lengthOf(1)
@@ -179,12 +180,13 @@ describe('Test ActivityPub video channels search', function () {
179 // Expire video channel 180 // Expire video channel
180 await wait(10000) 181 await wait(10000)
181 182
182 const search = 'http://localhost:9002/video-channels/channel1_server2' 183 const search = 'http://localhost:' + servers[ 1 ].port + '/video-channels/channel1_server2'
183 await searchVideoChannel(servers[0].url, search, servers[0].accessToken) 184 await searchVideoChannel(servers[0].url, search, servers[0].accessToken)
184 185
185 await waitJobs(servers) 186 await waitJobs(servers)
186 187
187 const res = await getVideoChannelVideos(servers[0].url, servers[0].accessToken, 'channel1_server2@localhost:9002', 0, 5, '-createdAt') 188 const videoChannelName = 'channel1_server2@localhost:' + servers[ 1 ].port
189 const res = await getVideoChannelVideos(servers[0].url, servers[0].accessToken, videoChannelName, 0, 5, '-createdAt')
188 190
189 expect(res.body.total).to.equal(2) 191 expect(res.body.total).to.equal(2)
190 expect(res.body.data[0].name).to.equal('video 2 server 2') 192 expect(res.body.data[0].name).to.equal('video 2 server 2')
@@ -200,7 +202,8 @@ describe('Test ActivityPub video channels search', function () {
200 // Expire video 202 // Expire video
201 await wait(10000) 203 await wait(10000)
202 204
203 const res = await searchVideoChannel(servers[0].url, 'http://localhost:9002/video-channels/channel1_server2', servers[0].accessToken) 205 const search = 'http://localhost:' + servers[ 1 ].port + '/video-channels/channel1_server2'
206 const res = await searchVideoChannel(servers[0].url, search, servers[0].accessToken)
204 expect(res.body.total).to.equal(0) 207 expect(res.body.total).to.equal(0)
205 expect(res.body.data).to.have.lengthOf(0) 208 expect(res.body.data).to.have.lengthOf(0)
206 }) 209 })