aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/notifications/user-notifications.ts41
-rw-r--r--server/tests/api/redundancy/redundancy.ts34
-rw-r--r--server/tests/api/search/search-activitypub-video-channels.ts37
-rw-r--r--server/tests/api/search/search-activitypub-videos.ts29
-rw-r--r--server/tests/api/search/search-videos.ts8
-rw-r--r--server/tests/api/server/contact-form.ts5
-rw-r--r--server/tests/api/server/email.ts28
-rw-r--r--server/tests/api/server/follow-constraints.ts46
-rw-r--r--server/tests/api/server/follows-moderation.ts20
-rw-r--r--server/tests/api/server/follows.ts59
-rw-r--r--server/tests/api/server/handle-down.ts4
-rw-r--r--server/tests/api/travis-1.sh10
-rw-r--r--server/tests/api/users/blocklist.ts28
-rw-r--r--server/tests/api/users/users-verification.ts5
-rw-r--r--server/tests/api/videos/multiple-servers.ts41
-rw-r--r--server/tests/api/videos/services.ts10
-rw-r--r--server/tests/api/videos/single-server.ts4
-rw-r--r--server/tests/api/videos/video-abuse.ts9
-rw-r--r--server/tests/api/videos/video-channels.ts6
-rw-r--r--server/tests/api/videos/video-comments.ts6
-rw-r--r--server/tests/api/videos/video-hls.ts9
-rw-r--r--server/tests/api/videos/video-transcoder.ts18
-rw-r--r--server/tests/cli/optimize-old-videos.ts10
23 files changed, 247 insertions, 220 deletions
diff --git a/server/tests/api/notifications/user-notifications.ts b/server/tests/api/notifications/user-notifications.ts
index f479e1785..662b64e05 100644
--- a/server/tests/api/notifications/user-notifications.ts
+++ b/server/tests/api/notifications/user-notifications.ts
@@ -114,11 +114,12 @@ describe('Test users notifications', function () {
114 before(async function () { 114 before(async function () {
115 this.timeout(120000) 115 this.timeout(120000)
116 116
117 await MockSmtpServer.Instance.collectEmails(emails) 117 const port = await MockSmtpServer.Instance.collectEmails(emails)
118 118
119 const overrideConfig = { 119 const overrideConfig = {
120 smtp: { 120 smtp: {
121 hostname: 'localhost' 121 hostname: 'localhost',
122 port
122 } 123 }
123 } 124 }
124 servers = await flushAndRunMultipleServers(3, overrideConfig) 125 servers = await flushAndRunMultipleServers(3, overrideConfig)
@@ -194,7 +195,7 @@ describe('Test users notifications', function () {
194 it('Should send a new video notification if the user follows the local video publisher', async function () { 195 it('Should send a new video notification if the user follows the local video publisher', async function () {
195 this.timeout(15000) 196 this.timeout(15000)
196 197
197 await addUserSubscription(servers[0].url, userAccessToken, 'root_channel@localhost:9001') 198 await addUserSubscription(servers[0].url, userAccessToken, 'root_channel@localhost:' + servers[0].port)
198 await waitJobs(servers) 199 await waitJobs(servers)
199 200
200 const { name, uuid } = await uploadVideoByLocalAccount(servers) 201 const { name, uuid } = await uploadVideoByLocalAccount(servers)
@@ -204,7 +205,7 @@ describe('Test users notifications', function () {
204 it('Should send a new video notification from a remote account', async function () { 205 it('Should send a new video notification from a remote account', async function () {
205 this.timeout(50000) // Server 2 has transcoding enabled 206 this.timeout(50000) // Server 2 has transcoding enabled
206 207
207 await addUserSubscription(servers[0].url, userAccessToken, 'root_channel@localhost:9002') 208 await addUserSubscription(servers[0].url, userAccessToken, 'root_channel@localhost:' + servers[1].port)
208 await waitJobs(servers) 209 await waitJobs(servers)
209 210
210 const { name, uuid } = await uploadVideoByRemoteAccount(servers) 211 const { name, uuid } = await uploadVideoByRemoteAccount(servers)
@@ -578,7 +579,9 @@ describe('Test users notifications', function () {
578 const uuid = resVideo.body.video.uuid 579 const uuid = resVideo.body.video.uuid
579 580
580 await waitJobs(servers) 581 await waitJobs(servers)
581 const resThread = await addVideoCommentThread(servers[1].url, servers[1].accessToken, uuid, 'hello @user_1@localhost:9001 1') 582
583 const text1 = `hello @user_1@localhost:${servers[ 0 ].port} 1`
584 const resThread = await addVideoCommentThread(servers[1].url, servers[1].accessToken, uuid, text1)
582 const server2ThreadId = resThread.body.comment.id 585 const server2ThreadId = resThread.body.comment.id
583 586
584 await waitJobs(servers) 587 await waitJobs(servers)
@@ -588,8 +591,8 @@ describe('Test users notifications', function () {
588 const server1ThreadId = resThread2.body.data[0].id 591 const server1ThreadId = resThread2.body.data[0].id
589 await checkCommentMention(baseParams, uuid, server1ThreadId, server1ThreadId, 'super root 2 name', 'presence') 592 await checkCommentMention(baseParams, uuid, server1ThreadId, server1ThreadId, 'super root 2 name', 'presence')
590 593
591 const text = '@user_1@localhost:9001 hello 2 @root@localhost:9001' 594 const text2 = `@user_1@localhost:${servers[ 0 ].port} hello 2 @root@localhost:${servers[ 0 ].port}`
592 await addVideoCommentReply(servers[1].url, servers[1].accessToken, uuid, server2ThreadId, text) 595 await addVideoCommentReply(servers[1].url, servers[1].accessToken, uuid, server2ThreadId, text2)
593 596
594 await waitJobs(servers) 597 await waitJobs(servers)
595 598
@@ -889,10 +892,10 @@ describe('Test users notifications', function () {
889 892
890 await waitJobs(servers) 893 await waitJobs(servers)
891 894
892 await checkNewInstanceFollower(baseParams, 'localhost:9003', 'presence') 895 await checkNewInstanceFollower(baseParams, 'localhost:' + servers[2].port, 'presence')
893 896
894 const userOverride = { socketNotifications: userNotifications, token: userAccessToken, check: { web: true, mail: false } } 897 const userOverride = { socketNotifications: userNotifications, token: userAccessToken, check: { web: true, mail: false } }
895 await checkNewInstanceFollower(immutableAssign(baseParams, userOverride), 'localhost:9003', 'absence') 898 await checkNewInstanceFollower(immutableAssign(baseParams, userOverride), 'localhost:' + servers[2].port, 'absence')
896 }) 899 })
897 }) 900 })
898 901
@@ -933,29 +936,29 @@ describe('Test users notifications', function () {
933 it('Should notify when a local channel is following one of our channel', async function () { 936 it('Should notify when a local channel is following one of our channel', async function () {
934 this.timeout(10000) 937 this.timeout(10000)
935 938
936 await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:9001') 939 await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:' + servers[0].port)
937 await waitJobs(servers) 940 await waitJobs(servers)
938 941
939 await checkNewActorFollow(baseParams, 'channel', 'root', 'super root name', myChannelName, 'presence') 942 await checkNewActorFollow(baseParams, 'channel', 'root', 'super root name', myChannelName, 'presence')
940 943
941 await removeUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:9001') 944 await removeUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:' + servers[0].port)
942 }) 945 })
943 946
944 it('Should notify when a remote channel is following one of our channel', async function () { 947 it('Should notify when a remote channel is following one of our channel', async function () {
945 this.timeout(10000) 948 this.timeout(10000)
946 949
947 await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:9001') 950 await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:' + servers[0].port)
948 await waitJobs(servers) 951 await waitJobs(servers)
949 952
950 await checkNewActorFollow(baseParams, 'channel', 'root', 'super root 2 name', myChannelName, 'presence') 953 await checkNewActorFollow(baseParams, 'channel', 'root', 'super root 2 name', myChannelName, 'presence')
951 954
952 await removeUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:9001') 955 await removeUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:' + servers[0].port)
953 }) 956 })
954 957
955 it('Should notify when a local account is following one of our channel', async function () { 958 it('Should notify when a local account is following one of our channel', async function () {
956 this.timeout(10000) 959 this.timeout(10000)
957 960
958 await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1@localhost:9001') 961 await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1@localhost:' + servers[0].port)
959 962
960 await waitJobs(servers) 963 await waitJobs(servers)
961 964
@@ -965,7 +968,7 @@ describe('Test users notifications', function () {
965 it('Should notify when a remote account is following one of our channel', async function () { 968 it('Should notify when a remote account is following one of our channel', async function () {
966 this.timeout(10000) 969 this.timeout(10000)
967 970
968 await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1@localhost:9001') 971 await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1@localhost:' + servers[0].port)
969 972
970 await waitJobs(servers) 973 await waitJobs(servers)
971 974
@@ -1019,8 +1022,8 @@ describe('Test users notifications', function () {
1019 autoBlacklistTestsCustomConfig.transcoding.enabled = true 1022 autoBlacklistTestsCustomConfig.transcoding.enabled = true
1020 await updateCustomConfig(servers[0].url, servers[0].accessToken, autoBlacklistTestsCustomConfig) 1023 await updateCustomConfig(servers[0].url, servers[0].accessToken, autoBlacklistTestsCustomConfig)
1021 1024
1022 await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:9001') 1025 await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:' + servers[0].port)
1023 await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:9001') 1026 await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:' + servers[0].port)
1024 1027
1025 }) 1028 })
1026 1029
@@ -1142,8 +1145,8 @@ describe('Test users notifications', function () {
1142 after(async () => { 1145 after(async () => {
1143 await updateCustomConfig(servers[0].url, servers[0].accessToken, currentCustomConfig) 1146 await updateCustomConfig(servers[0].url, servers[0].accessToken, currentCustomConfig)
1144 1147
1145 await removeUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:9001') 1148 await removeUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:' + servers[0].port)
1146 await removeUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:9001') 1149 await removeUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:' + servers[0].port)
1147 }) 1150 })
1148 }) 1151 })
1149 1152
diff --git a/server/tests/api/redundancy/redundancy.ts b/server/tests/api/redundancy/redundancy.ts
index e31329c25..6f2c59076 100644
--- a/server/tests/api/redundancy/redundancy.ts
+++ b/server/tests/api/redundancy/redundancy.ts
@@ -100,7 +100,7 @@ async function check1WebSeed (videoUUID?: string) {
100 if (!videoUUID) videoUUID = video1Server2UUID 100 if (!videoUUID) videoUUID = video1Server2UUID
101 101
102 const webseeds = [ 102 const webseeds = [
103 'http://localhost:9002/static/webseed/' + videoUUID 103 `http://localhost:${servers[ 1 ].port}/static/webseed/${videoUUID}`
104 ] 104 ]
105 105
106 for (const server of servers) { 106 for (const server of servers) {
@@ -118,8 +118,8 @@ async function check2Webseeds (videoUUID?: string) {
118 if (!videoUUID) videoUUID = video1Server2UUID 118 if (!videoUUID) videoUUID = video1Server2UUID
119 119
120 const webseeds = [ 120 const webseeds = [
121 'http://localhost:9001/static/redundancy/' + videoUUID, 121 `http://localhost:${servers[ 0 ].port}/static/redundancy/${videoUUID}`,
122 'http://localhost:9002/static/webseed/' + videoUUID 122 `http://localhost:${servers[ 1 ].port}/static/webseed/${videoUUID}`
123 ] 123 ]
124 124
125 for (const server of servers) { 125 for (const server of servers) {
@@ -145,7 +145,12 @@ async function check2Webseeds (videoUUID?: string) {
145 } 145 }
146 } 146 }
147 147
148 for (const directory of [ 'test1/redundancy', 'test2/videos' ]) { 148 const directories = [
149 'test' + servers[0].internalServerNumber + '/redundancy',
150 'test' + servers[1].internalServerNumber + '/videos'
151 ]
152
153 for (const directory of directories) {
149 const files = await readdir(join(root(), directory)) 154 const files = await readdir(join(root(), directory))
150 expect(files).to.have.length.at.least(4) 155 expect(files).to.have.length.at.least(4)
151 156
@@ -194,7 +199,12 @@ async function check1PlaylistRedundancies (videoUUID?: string) {
194 await checkSegmentHash(baseUrlPlaylist, baseUrlSegment, videoUUID, resolution, hlsPlaylist) 199 await checkSegmentHash(baseUrlPlaylist, baseUrlSegment, videoUUID, resolution, hlsPlaylist)
195 } 200 }
196 201
197 for (const directory of [ 'test1/redundancy/hls', 'test2/streaming-playlists/hls' ]) { 202 const directories = [
203 'test' + servers[0].internalServerNumber + '/redundancy/hls',
204 'test' + servers[1].internalServerNumber + '/streaming-playlists/hls'
205 ]
206
207 for (const directory of directories) {
198 const files = await readdir(join(root(), directory, videoUUID)) 208 const files = await readdir(join(root(), directory, videoUUID))
199 expect(files).to.have.length.at.least(4) 209 expect(files).to.have.length.at.least(4)
200 210
@@ -239,8 +249,8 @@ async function enableRedundancyOnServer1 () {
239 249
240 const res = await getFollowingListPaginationAndSort(servers[ 0 ].url, 0, 5, '-createdAt') 250 const res = await getFollowingListPaginationAndSort(servers[ 0 ].url, 0, 5, '-createdAt')
241 const follows: ActorFollow[] = res.body.data 251 const follows: ActorFollow[] = res.body.data
242 const server2 = follows.find(f => f.following.host === 'localhost:9002') 252 const server2 = follows.find(f => f.following.host === `localhost:${servers[ 1 ].port}`)
243 const server3 = follows.find(f => f.following.host === 'localhost:9003') 253 const server3 = follows.find(f => f.following.host === `localhost:${servers[ 2 ].port}`)
244 254
245 expect(server3).to.not.be.undefined 255 expect(server3).to.not.be.undefined
246 expect(server3.following.hostRedundancyAllowed).to.be.false 256 expect(server3.following.hostRedundancyAllowed).to.be.false
@@ -254,8 +264,8 @@ async function disableRedundancyOnServer1 () {
254 264
255 const res = await getFollowingListPaginationAndSort(servers[ 0 ].url, 0, 5, '-createdAt') 265 const res = await getFollowingListPaginationAndSort(servers[ 0 ].url, 0, 5, '-createdAt')
256 const follows: ActorFollow[] = res.body.data 266 const follows: ActorFollow[] = res.body.data
257 const server2 = follows.find(f => f.following.host === 'localhost:9002') 267 const server2 = follows.find(f => f.following.host === `localhost:${servers[ 1 ].port}`)
258 const server3 = follows.find(f => f.following.host === 'localhost:9003') 268 const server3 = follows.find(f => f.following.host === `localhost:${servers[ 2 ].port}`)
259 269
260 expect(server3).to.not.be.undefined 270 expect(server3).to.not.be.undefined
261 expect(server3.following.hostRedundancyAllowed).to.be.false 271 expect(server3.following.hostRedundancyAllowed).to.be.false
@@ -475,12 +485,12 @@ describe('Test videos redundancy', function () {
475 await wait(10000) 485 await wait(10000)
476 486
477 try { 487 try {
478 await checkContains(servers, 'http%3A%2F%2Flocalhost%3A9001') 488 await checkContains(servers, 'http%3A%2F%2Flocalhost%3A' + servers[0].port)
479 } catch { 489 } catch {
480 // Maybe a server deleted a redundancy in the scheduler 490 // Maybe a server deleted a redundancy in the scheduler
481 await wait(2000) 491 await wait(2000)
482 492
483 await checkContains(servers, 'http%3A%2F%2Flocalhost%3A9001') 493 await checkContains(servers, 'http%3A%2F%2Flocalhost%3A' + servers[0].port)
484 } 494 }
485 }) 495 })
486 496
@@ -491,7 +501,7 @@ describe('Test videos redundancy', function () {
491 501
492 await wait(15000) 502 await wait(15000)
493 503
494 await checkNotContains([ servers[1], servers[2] ], 'http%3A%2F%2Flocalhost%3A9001') 504 await checkNotContains([ servers[1], servers[2] ], 'http%3A%2F%2Flocalhost%3A' + servers[0].port)
495 }) 505 })
496 506
497 after(async function () { 507 after(async function () {
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 })
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'
4import 'mocha' 4import 'mocha'
5import { 5import {
6 addVideoChannel, 6 addVideoChannel,
7 cleanupTests,
7 flushAndRunMultipleServers, 8 flushAndRunMultipleServers,
8 flushTests,
9 getVideosList, 9 getVideosList,
10 killallServers,
11 removeVideo, 10 removeVideo,
11 searchVideo,
12 searchVideoWithToken, 12 searchVideoWithToken,
13 ServerInfo, 13 ServerInfo,
14 setAccessTokensToServers, 14 setAccessTokensToServers,
15 updateVideo, 15 updateVideo,
16 uploadVideo, 16 uploadVideo,
17 wait, 17 wait
18 searchVideo, cleanupTests
19} from '../../../../shared/extra-utils' 18} from '../../../../shared/extra-utils'
20import { waitJobs } from '../../../../shared/extra-utils/server/jobs' 19import { waitJobs } from '../../../../shared/extra-utils/server/jobs'
21import { Video, VideoPrivacy } from '../../../../shared/models/videos' 20import { Video, VideoPrivacy } from '../../../../shared/models/videos'
@@ -49,7 +48,8 @@ describe('Test ActivityPub videos search', function () {
49 48
50 it('Should not find a remote video', async function () { 49 it('Should not find a remote video', async function () {
51 { 50 {
52 const res = await searchVideoWithToken(servers[ 0 ].url, 'http://localhost:9002/videos/watch/43', servers[ 0 ].accessToken) 51 const search = 'http://localhost:' + servers[1].port + '/videos/watch/43'
52 const res = await searchVideoWithToken(servers[ 0 ].url, search, servers[ 0 ].accessToken)
53 53
54 expect(res.body.total).to.equal(0) 54 expect(res.body.total).to.equal(0)
55 expect(res.body.data).to.be.an('array') 55 expect(res.body.data).to.be.an('array')
@@ -58,7 +58,8 @@ describe('Test ActivityPub videos search', function () {
58 58
59 { 59 {
60 // Without token 60 // Without token
61 const res = await searchVideo(servers[0].url, 'http://localhost:9002/videos/watch/' + videoServer2UUID) 61 const search = 'http://localhost:' + servers[1].port + '/videos/watch/' + videoServer2UUID
62 const res = await searchVideo(servers[0].url, search)
62 63
63 expect(res.body.total).to.equal(0) 64 expect(res.body.total).to.equal(0)
64 expect(res.body.data).to.be.an('array') 65 expect(res.body.data).to.be.an('array')
@@ -67,7 +68,8 @@ describe('Test ActivityPub videos search', function () {
67 }) 68 })
68 69
69 it('Should search a local video', async function () { 70 it('Should search a local video', async function () {
70 const res = await searchVideo(servers[0].url, 'http://localhost:9001/videos/watch/' + videoServer1UUID) 71 const search = 'http://localhost:' + servers[0].port + '/videos/watch/' + videoServer1UUID
72 const res = await searchVideo(servers[0].url, search)
71 73
72 expect(res.body.total).to.equal(1) 74 expect(res.body.total).to.equal(1)
73 expect(res.body.data).to.be.an('array') 75 expect(res.body.data).to.be.an('array')
@@ -76,7 +78,8 @@ describe('Test ActivityPub videos search', function () {
76 }) 78 })
77 79
78 it('Should search a remote video', async function () { 80 it('Should search a remote video', async function () {
79 const res = await searchVideoWithToken(servers[0].url, 'http://localhost:9002/videos/watch/' + videoServer2UUID, servers[0].accessToken) 81 const search = 'http://localhost:' + servers[1].port + '/videos/watch/' + videoServer2UUID
82 const res = await searchVideoWithToken(servers[0].url, search, servers[0].accessToken)
80 83
81 expect(res.body.total).to.equal(1) 84 expect(res.body.total).to.equal(1)
82 expect(res.body.data).to.be.an('array') 85 expect(res.body.data).to.be.an('array')
@@ -114,12 +117,13 @@ describe('Test ActivityPub videos search', function () {
114 await wait(10000) 117 await wait(10000)
115 118
116 // Will run refresh async 119 // Will run refresh async
117 await searchVideoWithToken(servers[0].url, 'http://localhost:9002/videos/watch/' + videoServer2UUID, servers[0].accessToken) 120 const search = 'http://localhost:' + servers[1].port + '/videos/watch/' + videoServer2UUID
121 await searchVideoWithToken(servers[0].url, search, servers[0].accessToken)
118 122
119 // Wait refresh 123 // Wait refresh
120 await wait(5000) 124 await wait(5000)
121 125
122 const res = await searchVideoWithToken(servers[0].url, 'http://localhost:9002/videos/watch/' + videoServer2UUID, servers[0].accessToken) 126 const res = await searchVideoWithToken(servers[0].url, search, servers[0].accessToken)
123 expect(res.body.total).to.equal(1) 127 expect(res.body.total).to.equal(1)
124 expect(res.body.data).to.have.lengthOf(1) 128 expect(res.body.data).to.have.lengthOf(1)
125 129
@@ -139,12 +143,13 @@ describe('Test ActivityPub videos search', function () {
139 await wait(10000) 143 await wait(10000)
140 144
141 // Will run refresh async 145 // Will run refresh async
142 await searchVideoWithToken(servers[0].url, 'http://localhost:9002/videos/watch/' + videoServer2UUID, servers[0].accessToken) 146 const search = 'http://localhost:' + servers[1].port + '/videos/watch/' + videoServer2UUID
147 await searchVideoWithToken(servers[0].url, search, servers[0].accessToken)
143 148
144 // Wait refresh 149 // Wait refresh
145 await wait(5000) 150 await wait(5000)
146 151
147 const res = await searchVideoWithToken(servers[0].url, 'http://localhost:9002/videos/watch/' + videoServer2UUID, servers[0].accessToken) 152 const res = await searchVideoWithToken(servers[0].url, search, servers[0].accessToken)
148 expect(res.body.total).to.equal(0) 153 expect(res.body.total).to.equal(0)
149 expect(res.body.data).to.have.lengthOf(0) 154 expect(res.body.data).to.have.lengthOf(0)
150 }) 155 })
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'
4import 'mocha' 4import 'mocha'
5import { 5import {
6 advancedVideosSearch, 6 advancedVideosSearch,
7 flushTests, 7 cleanupTests,
8 killallServers,
9 flushAndRunServer, 8 flushAndRunServer,
9 immutableAssign,
10 searchVideo, 10 searchVideo,
11 ServerInfo, 11 ServerInfo,
12 setAccessTokensToServers, 12 setAccessTokensToServers,
13 uploadVideo, 13 uploadVideo,
14 wait, 14 wait
15 immutableAssign,
16 cleanupTests
17} from '../../../../shared/extra-utils' 15} from '../../../../shared/extra-utils'
18 16
19const expect = chai.expect 17const expect = chai.expect
diff --git a/server/tests/api/server/contact-form.ts b/server/tests/api/server/contact-form.ts
index ba51198b3..0a1c49ef5 100644
--- a/server/tests/api/server/contact-form.ts
+++ b/server/tests/api/server/contact-form.ts
@@ -24,11 +24,12 @@ describe('Test contact form', function () {
24 before(async function () { 24 before(async function () {
25 this.timeout(30000) 25 this.timeout(30000)
26 26
27 await MockSmtpServer.Instance.collectEmails(emails) 27 const port = await MockSmtpServer.Instance.collectEmails(emails)
28 28
29 const overrideConfig = { 29 const overrideConfig = {
30 smtp: { 30 smtp: {
31 hostname: 'localhost' 31 hostname: 'localhost',
32 port
32 } 33 }
33 } 34 }
34 server = await flushAndRunServer(1, overrideConfig) 35 server = await flushAndRunServer(1, overrideConfig)
diff --git a/server/tests/api/server/email.ts b/server/tests/api/server/email.ts
index bacdf1b1b..9ccb1c36f 100644
--- a/server/tests/api/server/email.ts
+++ b/server/tests/api/server/email.ts
@@ -7,18 +7,18 @@ import {
7 askResetPassword, 7 askResetPassword,
8 askSendVerifyEmail, 8 askSendVerifyEmail,
9 blockUser, 9 blockUser,
10 createUser, removeVideoFromBlacklist, 10 cleanupTests,
11 createUser,
12 flushAndRunServer,
13 removeVideoFromBlacklist,
11 reportVideoAbuse, 14 reportVideoAbuse,
12 resetPassword, 15 resetPassword,
13 flushAndRunServer, 16 ServerInfo,
17 setAccessTokensToServers,
14 unblockUser, 18 unblockUser,
15 uploadVideo, 19 uploadVideo,
16 userLogin, 20 userLogin,
17 verifyEmail, 21 verifyEmail
18 flushTests,
19 killallServers,
20 ServerInfo,
21 setAccessTokensToServers, cleanupTests
22} from '../../../../shared/extra-utils' 22} from '../../../../shared/extra-utils'
23import { MockSmtpServer } from '../../../../shared/extra-utils/miscs/email' 23import { MockSmtpServer } from '../../../../shared/extra-utils/miscs/email'
24import { waitJobs } from '../../../../shared/extra-utils/server/jobs' 24import { waitJobs } from '../../../../shared/extra-utils/server/jobs'
@@ -87,7 +87,7 @@ describe('Test emails', function () {
87 87
88 const email = emails[0] 88 const email = emails[0]
89 89
90 expect(email['from'][0]['name']).equal('localhost:9001') 90 expect(email['from'][0]['name']).equal('localhost:' + server.port)
91 expect(email['from'][0]['address']).equal('test-admin@localhost') 91 expect(email['from'][0]['address']).equal('test-admin@localhost')
92 expect(email['to'][0]['address']).equal('user_1@example.com') 92 expect(email['to'][0]['address']).equal('user_1@example.com')
93 expect(email['subject']).contains('password') 93 expect(email['subject']).contains('password')
@@ -132,7 +132,7 @@ describe('Test emails', function () {
132 132
133 const email = emails[1] 133 const email = emails[1]
134 134
135 expect(email['from'][0]['name']).equal('localhost:9001') 135 expect(email['from'][0]['name']).equal('localhost:' + server.port)
136 expect(email['from'][0]['address']).equal('test-admin@localhost') 136 expect(email['from'][0]['address']).equal('test-admin@localhost')
137 expect(email['to'][0]['address']).equal('admin1@example.com') 137 expect(email['to'][0]['address']).equal('admin1@example.com')
138 expect(email['subject']).contains('abuse') 138 expect(email['subject']).contains('abuse')
@@ -153,7 +153,7 @@ describe('Test emails', function () {
153 153
154 const email = emails[2] 154 const email = emails[2]
155 155
156 expect(email['from'][0]['name']).equal('localhost:9001') 156 expect(email['from'][0]['name']).equal('localhost:' + server.port)
157 expect(email['from'][0]['address']).equal('test-admin@localhost') 157 expect(email['from'][0]['address']).equal('test-admin@localhost')
158 expect(email['to'][0]['address']).equal('user_1@example.com') 158 expect(email['to'][0]['address']).equal('user_1@example.com')
159 expect(email['subject']).contains(' blocked') 159 expect(email['subject']).contains(' blocked')
@@ -171,7 +171,7 @@ describe('Test emails', function () {
171 171
172 const email = emails[3] 172 const email = emails[3]
173 173
174 expect(email['from'][0]['name']).equal('localhost:9001') 174 expect(email['from'][0]['name']).equal('localhost:' + server.port)
175 expect(email['from'][0]['address']).equal('test-admin@localhost') 175 expect(email['from'][0]['address']).equal('test-admin@localhost')
176 expect(email['to'][0]['address']).equal('user_1@example.com') 176 expect(email['to'][0]['address']).equal('user_1@example.com')
177 expect(email['subject']).contains(' unblocked') 177 expect(email['subject']).contains(' unblocked')
@@ -191,7 +191,7 @@ describe('Test emails', function () {
191 191
192 const email = emails[4] 192 const email = emails[4]
193 193
194 expect(email['from'][0]['name']).equal('localhost:9001') 194 expect(email['from'][0]['name']).equal('localhost:' + server.port)
195 expect(email['from'][0]['address']).equal('test-admin@localhost') 195 expect(email['from'][0]['address']).equal('test-admin@localhost')
196 expect(email['to'][0]['address']).equal('user_1@example.com') 196 expect(email['to'][0]['address']).equal('user_1@example.com')
197 expect(email['subject']).contains(' blacklisted') 197 expect(email['subject']).contains(' blacklisted')
@@ -209,7 +209,7 @@ describe('Test emails', function () {
209 209
210 const email = emails[5] 210 const email = emails[5]
211 211
212 expect(email['from'][0]['name']).equal('localhost:9001') 212 expect(email['from'][0]['name']).equal('localhost:' + server.port)
213 expect(email['from'][0]['address']).equal('test-admin@localhost') 213 expect(email['from'][0]['address']).equal('test-admin@localhost')
214 expect(email['to'][0]['address']).equal('user_1@example.com') 214 expect(email['to'][0]['address']).equal('user_1@example.com')
215 expect(email['subject']).contains(' unblacklisted') 215 expect(email['subject']).contains(' unblacklisted')
@@ -229,7 +229,7 @@ describe('Test emails', function () {
229 229
230 const email = emails[6] 230 const email = emails[6]
231 231
232 expect(email['from'][0]['name']).equal('localhost:9001') 232 expect(email['from'][0]['name']).equal('localhost:' + server.port)
233 expect(email['from'][0]['address']).equal('test-admin@localhost') 233 expect(email['from'][0]['address']).equal('test-admin@localhost')
234 expect(email['to'][0]['address']).equal('user_1@example.com') 234 expect(email['to'][0]['address']).equal('user_1@example.com')
235 expect(email['subject']).contains('Verify') 235 expect(email['subject']).contains('Verify')
diff --git a/server/tests/api/server/follow-constraints.ts b/server/tests/api/server/follow-constraints.ts
index 4285a9e7a..ac3ff37f0 100644
--- a/server/tests/api/server/follow-constraints.ts
+++ b/server/tests/api/server/follow-constraints.ts
@@ -3,16 +3,16 @@
3import * as chai from 'chai' 3import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { 5import {
6 cleanupTests,
6 doubleFollow, 7 doubleFollow,
8 flushAndRunMultipleServers,
7 getAccountVideos, 9 getAccountVideos,
8 getVideo, 10 getVideo,
9 getVideoChannelVideos, 11 getVideoChannelVideos,
10 getVideoWithToken, 12 getVideoWithToken,
11 flushAndRunMultipleServers,
12 killallServers,
13 ServerInfo, 13 ServerInfo,
14 setAccessTokensToServers, 14 setAccessTokensToServers,
15 uploadVideo, cleanupTests 15 uploadVideo
16} from '../../../../shared/extra-utils' 16} from '../../../../shared/extra-utils'
17import { unfollow } from '../../../../shared/extra-utils/server/follows' 17import { unfollow } from '../../../../shared/extra-utils/server/follows'
18import { userLogin } from '../../../../shared/extra-utils/users/login' 18import { userLogin } from '../../../../shared/extra-utils/users/login'
@@ -66,28 +66,30 @@ describe('Test follow constraints', function () {
66 }) 66 })
67 67
68 it('Should list local account videos', async function () { 68 it('Should list local account videos', async function () {
69 const res = await getAccountVideos(servers[0].url, undefined, 'root@localhost:9001', 0, 5) 69 const res = await getAccountVideos(servers[0].url, undefined, 'root@localhost:' + servers[0].port, 0, 5)
70 70
71 expect(res.body.total).to.equal(1) 71 expect(res.body.total).to.equal(1)
72 expect(res.body.data).to.have.lengthOf(1) 72 expect(res.body.data).to.have.lengthOf(1)
73 }) 73 })
74 74
75 it('Should list remote account videos', async function () { 75 it('Should list remote account videos', async function () {
76 const res = await getAccountVideos(servers[0].url, undefined, 'root@localhost:9002', 0, 5) 76 const res = await getAccountVideos(servers[0].url, undefined, 'root@localhost:' + servers[1].port, 0, 5)
77 77
78 expect(res.body.total).to.equal(1) 78 expect(res.body.total).to.equal(1)
79 expect(res.body.data).to.have.lengthOf(1) 79 expect(res.body.data).to.have.lengthOf(1)
80 }) 80 })
81 81
82 it('Should list local channel videos', async function () { 82 it('Should list local channel videos', async function () {
83 const res = await getVideoChannelVideos(servers[0].url, undefined, 'root_channel@localhost:9001', 0, 5) 83 const videoChannelName = 'root_channel@localhost:' + servers[0].port
84 const res = await getVideoChannelVideos(servers[0].url, undefined, videoChannelName, 0, 5)
84 85
85 expect(res.body.total).to.equal(1) 86 expect(res.body.total).to.equal(1)
86 expect(res.body.data).to.have.lengthOf(1) 87 expect(res.body.data).to.have.lengthOf(1)
87 }) 88 })
88 89
89 it('Should list remote channel videos', async function () { 90 it('Should list remote channel videos', async function () {
90 const res = await getVideoChannelVideos(servers[0].url, undefined, 'root_channel@localhost:9002', 0, 5) 91 const videoChannelName = 'root_channel@localhost:' + servers[1].port
92 const res = await getVideoChannelVideos(servers[0].url, undefined, videoChannelName, 0, 5)
91 93
92 expect(res.body.total).to.equal(1) 94 expect(res.body.total).to.equal(1)
93 expect(res.body.data).to.have.lengthOf(1) 95 expect(res.body.data).to.have.lengthOf(1)
@@ -104,28 +106,30 @@ describe('Test follow constraints', function () {
104 }) 106 })
105 107
106 it('Should list local account videos', async function () { 108 it('Should list local account videos', async function () {
107 const res = await getAccountVideos(servers[0].url, userAccessToken, 'root@localhost:9001', 0, 5) 109 const res = await getAccountVideos(servers[0].url, userAccessToken, 'root@localhost:' + servers[0].port, 0, 5)
108 110
109 expect(res.body.total).to.equal(1) 111 expect(res.body.total).to.equal(1)
110 expect(res.body.data).to.have.lengthOf(1) 112 expect(res.body.data).to.have.lengthOf(1)
111 }) 113 })
112 114
113 it('Should list remote account videos', async function () { 115 it('Should list remote account videos', async function () {
114 const res = await getAccountVideos(servers[0].url, userAccessToken, 'root@localhost:9002', 0, 5) 116 const res = await getAccountVideos(servers[0].url, userAccessToken, 'root@localhost:' + servers[1].port, 0, 5)
115 117
116 expect(res.body.total).to.equal(1) 118 expect(res.body.total).to.equal(1)
117 expect(res.body.data).to.have.lengthOf(1) 119 expect(res.body.data).to.have.lengthOf(1)
118 }) 120 })
119 121
120 it('Should list local channel videos', async function () { 122 it('Should list local channel videos', async function () {
121 const res = await getVideoChannelVideos(servers[0].url, userAccessToken, 'root_channel@localhost:9001', 0, 5) 123 const videoChannelName = 'root_channel@localhost:' + servers[0].port
124 const res = await getVideoChannelVideos(servers[0].url, userAccessToken, videoChannelName, 0, 5)
122 125
123 expect(res.body.total).to.equal(1) 126 expect(res.body.total).to.equal(1)
124 expect(res.body.data).to.have.lengthOf(1) 127 expect(res.body.data).to.have.lengthOf(1)
125 }) 128 })
126 129
127 it('Should list remote channel videos', async function () { 130 it('Should list remote channel videos', async function () {
128 const res = await getVideoChannelVideos(servers[0].url, userAccessToken, 'root_channel@localhost:9002', 0, 5) 131 const videoChannelName = 'root_channel@localhost:' + servers[1].port
132 const res = await getVideoChannelVideos(servers[0].url, userAccessToken, videoChannelName, 0, 5)
129 133
130 expect(res.body.total).to.equal(1) 134 expect(res.body.total).to.equal(1)
131 expect(res.body.data).to.have.lengthOf(1) 135 expect(res.body.data).to.have.lengthOf(1)
@@ -152,28 +156,30 @@ describe('Test follow constraints', function () {
152 }) 156 })
153 157
154 it('Should list local account videos', async function () { 158 it('Should list local account videos', async function () {
155 const res = await getAccountVideos(servers[0].url, undefined, 'root@localhost:9001', 0, 5) 159 const res = await getAccountVideos(servers[0].url, undefined, 'root@localhost:' + servers[0].port, 0, 5)
156 160
157 expect(res.body.total).to.equal(1) 161 expect(res.body.total).to.equal(1)
158 expect(res.body.data).to.have.lengthOf(1) 162 expect(res.body.data).to.have.lengthOf(1)
159 }) 163 })
160 164
161 it('Should not list remote account videos', async function () { 165 it('Should not list remote account videos', async function () {
162 const res = await getAccountVideos(servers[0].url, undefined, 'root@localhost:9002', 0, 5) 166 const res = await getAccountVideos(servers[0].url, undefined, 'root@localhost:' + servers[1].port, 0, 5)
163 167
164 expect(res.body.total).to.equal(0) 168 expect(res.body.total).to.equal(0)
165 expect(res.body.data).to.have.lengthOf(0) 169 expect(res.body.data).to.have.lengthOf(0)
166 }) 170 })
167 171
168 it('Should list local channel videos', async function () { 172 it('Should list local channel videos', async function () {
169 const res = await getVideoChannelVideos(servers[0].url, undefined, 'root_channel@localhost:9001', 0, 5) 173 const videoChannelName = 'root_channel@localhost:' + servers[0].port
174 const res = await getVideoChannelVideos(servers[0].url, undefined, videoChannelName, 0, 5)
170 175
171 expect(res.body.total).to.equal(1) 176 expect(res.body.total).to.equal(1)
172 expect(res.body.data).to.have.lengthOf(1) 177 expect(res.body.data).to.have.lengthOf(1)
173 }) 178 })
174 179
175 it('Should not list remote channel videos', async function () { 180 it('Should not list remote channel videos', async function () {
176 const res = await getVideoChannelVideos(servers[0].url, undefined, 'root_channel@localhost:9002', 0, 5) 181 const videoChannelName = 'root_channel@localhost:' + servers[1].port
182 const res = await getVideoChannelVideos(servers[0].url, undefined, videoChannelName, 0, 5)
177 183
178 expect(res.body.total).to.equal(0) 184 expect(res.body.total).to.equal(0)
179 expect(res.body.data).to.have.lengthOf(0) 185 expect(res.body.data).to.have.lengthOf(0)
@@ -190,28 +196,30 @@ describe('Test follow constraints', function () {
190 }) 196 })
191 197
192 it('Should list local account videos', async function () { 198 it('Should list local account videos', async function () {
193 const res = await getAccountVideos(servers[0].url, userAccessToken, 'root@localhost:9001', 0, 5) 199 const res = await getAccountVideos(servers[0].url, userAccessToken, 'root@localhost:' + servers[0].port, 0, 5)
194 200
195 expect(res.body.total).to.equal(1) 201 expect(res.body.total).to.equal(1)
196 expect(res.body.data).to.have.lengthOf(1) 202 expect(res.body.data).to.have.lengthOf(1)
197 }) 203 })
198 204
199 it('Should list remote account videos', async function () { 205 it('Should list remote account videos', async function () {
200 const res = await getAccountVideos(servers[0].url, userAccessToken, 'root@localhost:9002', 0, 5) 206 const res = await getAccountVideos(servers[0].url, userAccessToken, 'root@localhost:' + servers[1].port, 0, 5)
201 207
202 expect(res.body.total).to.equal(1) 208 expect(res.body.total).to.equal(1)
203 expect(res.body.data).to.have.lengthOf(1) 209 expect(res.body.data).to.have.lengthOf(1)
204 }) 210 })
205 211
206 it('Should list local channel videos', async function () { 212 it('Should list local channel videos', async function () {
207 const res = await getVideoChannelVideos(servers[0].url, userAccessToken, 'root_channel@localhost:9001', 0, 5) 213 const videoChannelName = 'root_channel@localhost:' + servers[0].port
214 const res = await getVideoChannelVideos(servers[0].url, userAccessToken, videoChannelName, 0, 5)
208 215
209 expect(res.body.total).to.equal(1) 216 expect(res.body.total).to.equal(1)
210 expect(res.body.data).to.have.lengthOf(1) 217 expect(res.body.data).to.have.lengthOf(1)
211 }) 218 })
212 219
213 it('Should list remote channel videos', async function () { 220 it('Should list remote channel videos', async function () {
214 const res = await getVideoChannelVideos(servers[0].url, userAccessToken, 'root_channel@localhost:9002', 0, 5) 221 const videoChannelName = 'root_channel@localhost:' + servers[1].port
222 const res = await getVideoChannelVideos(servers[0].url, userAccessToken, videoChannelName, 0, 5)
215 223
216 expect(res.body.total).to.equal(1) 224 expect(res.body.total).to.equal(1)
217 expect(res.body.data).to.have.lengthOf(1) 225 expect(res.body.data).to.have.lengthOf(1)
diff --git a/server/tests/api/server/follows-moderation.ts b/server/tests/api/server/follows-moderation.ts
index 2a3a4d5c8..fc20f8961 100644
--- a/server/tests/api/server/follows-moderation.ts
+++ b/server/tests/api/server/follows-moderation.ts
@@ -3,9 +3,9 @@
3import * as chai from 'chai' 3import * as chai from 'chai'
4import 'mocha' 4import 'mocha'
5import { 5import {
6 acceptFollower, cleanupTests, 6 acceptFollower,
7 cleanupTests,
7 flushAndRunMultipleServers, 8 flushAndRunMultipleServers,
8 killallServers,
9 ServerInfo, 9 ServerInfo,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 updateCustomSubConfig 11 updateCustomSubConfig
@@ -14,8 +14,8 @@ import {
14 follow, 14 follow,
15 getFollowersListPaginationAndSort, 15 getFollowersListPaginationAndSort,
16 getFollowingListPaginationAndSort, 16 getFollowingListPaginationAndSort,
17 removeFollower, 17 rejectFollower,
18 rejectFollower 18 removeFollower
19} from '../../../../shared/extra-utils/server/follows' 19} from '../../../../shared/extra-utils/server/follows'
20import { waitJobs } from '../../../../shared/extra-utils/server/jobs' 20import { waitJobs } from '../../../../shared/extra-utils/server/jobs'
21import { ActorFollow } from '../../../../shared/models/actors' 21import { ActorFollow } from '../../../../shared/models/actors'
@@ -29,8 +29,8 @@ async function checkServer1And2HasFollowers (servers: ServerInfo[], state = 'acc
29 29
30 const follow = res.body.data[0] as ActorFollow 30 const follow = res.body.data[0] as ActorFollow
31 expect(follow.state).to.equal(state) 31 expect(follow.state).to.equal(state)
32 expect(follow.follower.url).to.equal('http://localhost:9001/accounts/peertube') 32 expect(follow.follower.url).to.equal('http://localhost:' + servers[0].port + 'accounts/peertube')
33 expect(follow.following.url).to.equal('http://localhost:9002/accounts/peertube') 33 expect(follow.following.url).to.equal('http://localhost:' + servers[1].port + '/accounts/peertube')
34 } 34 }
35 35
36 { 36 {
@@ -39,8 +39,8 @@ async function checkServer1And2HasFollowers (servers: ServerInfo[], state = 'acc
39 39
40 const follow = res.body.data[0] as ActorFollow 40 const follow = res.body.data[0] as ActorFollow
41 expect(follow.state).to.equal(state) 41 expect(follow.state).to.equal(state)
42 expect(follow.follower.url).to.equal('http://localhost:9001/accounts/peertube') 42 expect(follow.follower.url).to.equal('http://localhost:' + servers[0].port + 'accounts/peertube')
43 expect(follow.following.url).to.equal('http://localhost:9002/accounts/peertube') 43 expect(follow.following.url).to.equal('http://localhost:' + servers[1].port + '/accounts/peertube')
44 } 44 }
45} 45}
46 46
@@ -151,7 +151,7 @@ describe('Test follows moderation', function () {
151 }) 151 })
152 152
153 it('Should accept a follower', async function () { 153 it('Should accept a follower', async function () {
154 await acceptFollower(servers[1].url, servers[1].accessToken, 'peertube@localhost:9001') 154 await acceptFollower(servers[1].url, servers[1].accessToken, 'peertube@localhost:' + servers[0].port)
155 await waitJobs(servers) 155 await waitJobs(servers)
156 156
157 await checkServer1And2HasFollowers(servers) 157 await checkServer1And2HasFollowers(servers)
@@ -178,7 +178,7 @@ describe('Test follows moderation', function () {
178 expect(res.body.total).to.equal(1) 178 expect(res.body.total).to.equal(1)
179 } 179 }
180 180
181 await rejectFollower(servers[2].url, servers[2].accessToken, 'peertube@localhost:9001') 181 await rejectFollower(servers[2].url, servers[2].accessToken, 'peertube@localhost:' + servers[0].port)
182 await waitJobs(servers) 182 await waitJobs(servers)
183 183
184 await checkServer1And2HasFollowers(servers) 184 await checkServer1And2HasFollowers(servers)
diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts
index 397093cdb..d4155667f 100644
--- a/server/tests/api/server/follows.ts
+++ b/server/tests/api/server/follows.ts
@@ -8,7 +8,6 @@ import { cleanupTests, completeVideoCheck } from '../../../../shared/extra-utils
8import { 8import {
9 flushAndRunMultipleServers, 9 flushAndRunMultipleServers,
10 getVideosList, 10 getVideosList,
11 killallServers,
12 ServerInfo, 11 ServerInfo,
13 setAccessTokensToServers, 12 setAccessTokensToServers,
14 uploadVideo 13 uploadVideo
@@ -89,8 +88,8 @@ describe('Test follows', function () {
89 res = await getFollowingListPaginationAndSort(servers[0].url, 1, 1, 'createdAt') 88 res = await getFollowingListPaginationAndSort(servers[0].url, 1, 1, 'createdAt')
90 follows = follows.concat(res.body.data) 89 follows = follows.concat(res.body.data)
91 90
92 const server2Follow = follows.find(f => f.following.host === 'localhost:9002') 91 const server2Follow = follows.find(f => f.following.host === 'localhost:' + servers[1].port)
93 const server3Follow = follows.find(f => f.following.host === 'localhost:9003') 92 const server3Follow = follows.find(f => f.following.host === 'localhost:' + servers[2].port)
94 93
95 expect(server2Follow).to.not.be.undefined 94 expect(server2Follow).to.not.be.undefined
96 expect(server3Follow).to.not.be.undefined 95 expect(server3Follow).to.not.be.undefined
@@ -100,12 +99,12 @@ describe('Test follows', function () {
100 99
101 it('Should search followings on server 1', async function () { 100 it('Should search followings on server 1', async function () {
102 { 101 {
103 const res = await getFollowingListPaginationAndSort(servers[ 0 ].url, 0, 1, 'createdAt', ':9002') 102 const res = await getFollowingListPaginationAndSort(servers[ 0 ].url, 0, 1, 'createdAt', ':' + servers[1].port)
104 const follows = res.body.data 103 const follows = res.body.data
105 104
106 expect(res.body.total).to.equal(1) 105 expect(res.body.total).to.equal(1)
107 expect(follows.length).to.equal(1) 106 expect(follows.length).to.equal(1)
108 expect(follows[ 0 ].following.host).to.equal('localhost:9002') 107 expect(follows[ 0 ].following.host).to.equal('localhost:' + servers[1].port)
109 } 108 }
110 109
111 { 110 {
@@ -136,7 +135,7 @@ describe('Test follows', function () {
136 expect(res.body.total).to.equal(1) 135 expect(res.body.total).to.equal(1)
137 expect(follows).to.be.an('array') 136 expect(follows).to.be.an('array')
138 expect(follows.length).to.equal(1) 137 expect(follows.length).to.equal(1)
139 expect(follows[0].follower.host).to.equal('localhost:9001') 138 expect(follows[0].follower.host).to.equal('localhost:' + servers[0].port)
140 } 139 }
141 }) 140 })
142 141
@@ -147,7 +146,7 @@ describe('Test follows', function () {
147 146
148 expect(res.body.total).to.equal(1) 147 expect(res.body.total).to.equal(1)
149 expect(follows.length).to.equal(1) 148 expect(follows.length).to.equal(1)
150 expect(follows[ 0 ].following.host).to.equal('localhost:9003') 149 expect(follows[ 0 ].following.host).to.equal('localhost:' + servers[2].port)
151 } 150 }
152 151
153 { 152 {
@@ -169,16 +168,16 @@ describe('Test follows', function () {
169 }) 168 })
170 169
171 it('Should have the correct follows counts', async function () { 170 it('Should have the correct follows counts', async function () {
172 await expectAccountFollows(servers[0].url, 'peertube@localhost:9001', 0, 2) 171 await expectAccountFollows(servers[0].url, 'peertube@localhost:' + servers[0].port, 0, 2)
173 await expectAccountFollows(servers[0].url, 'peertube@localhost:9002', 1, 0) 172 await expectAccountFollows(servers[0].url, 'peertube@localhost:' + servers[1].port, 1, 0)
174 await expectAccountFollows(servers[0].url, 'peertube@localhost:9003', 1, 0) 173 await expectAccountFollows(servers[0].url, 'peertube@localhost:' + servers[2].port, 1, 0)
175 174
176 // Server 2 and 3 does not know server 1 follow another server (there was not a refresh) 175 // Server 2 and 3 does not know server 1 follow another server (there was not a refresh)
177 await expectAccountFollows(servers[1].url, 'peertube@localhost:9001', 0, 1) 176 await expectAccountFollows(servers[1].url, 'peertube@localhost:' + servers[0].port, 0, 1)
178 await expectAccountFollows(servers[1].url, 'peertube@localhost:9002', 1, 0) 177 await expectAccountFollows(servers[1].url, 'peertube@localhost:' + servers[1].port, 1, 0)
179 178
180 await expectAccountFollows(servers[2].url, 'peertube@localhost:9001', 0, 1) 179 await expectAccountFollows(servers[2].url, 'peertube@localhost:' + servers[0].port, 0, 1)
181 await expectAccountFollows(servers[2].url, 'peertube@localhost:9003', 1, 0) 180 await expectAccountFollows(servers[2].url, 'peertube@localhost:' + servers[2].port, 1, 0)
182 }) 181 })
183 182
184 it('Should unfollow server 3 on server 1', async function () { 183 it('Should unfollow server 3 on server 1', async function () {
@@ -197,7 +196,7 @@ describe('Test follows', function () {
197 expect(follows).to.be.an('array') 196 expect(follows).to.be.an('array')
198 expect(follows.length).to.equal(1) 197 expect(follows.length).to.equal(1)
199 198
200 expect(follows[0].following.host).to.equal('localhost:9002') 199 expect(follows[0].following.host).to.equal('localhost:' + servers[1].port)
201 }) 200 })
202 201
203 it('Should not have server 1 as follower on server 3 anymore', async function () { 202 it('Should not have server 1 as follower on server 3 anymore', async function () {
@@ -210,14 +209,14 @@ describe('Test follows', function () {
210 }) 209 })
211 210
212 it('Should have the correct follows counts 2', async function () { 211 it('Should have the correct follows counts 2', async function () {
213 await expectAccountFollows(servers[0].url, 'peertube@localhost:9001', 0, 1) 212 await expectAccountFollows(servers[0].url, 'peertube@localhost:' + servers[0].port, 0, 1)
214 await expectAccountFollows(servers[0].url, 'peertube@localhost:9002', 1, 0) 213 await expectAccountFollows(servers[0].url, 'peertube@localhost:' + servers[1].port, 1, 0)
215 214
216 await expectAccountFollows(servers[1].url, 'peertube@localhost:9001', 0, 1) 215 await expectAccountFollows(servers[1].url, 'peertube@localhost:' + servers[0].port, 0, 1)
217 await expectAccountFollows(servers[1].url, 'peertube@localhost:9002', 1, 0) 216 await expectAccountFollows(servers[1].url, 'peertube@localhost:' + servers[1].port, 1, 0)
218 217
219 await expectAccountFollows(servers[2].url, 'peertube@localhost:9001', 0, 0) 218 await expectAccountFollows(servers[2].url, 'peertube@localhost:' + servers[0].port, 0, 0)
220 await expectAccountFollows(servers[2].url, 'peertube@localhost:9003', 0, 0) 219 await expectAccountFollows(servers[2].url, 'peertube@localhost:' + servers[2].port, 0, 0)
221 }) 220 })
222 221
223 it('Should upload a video on server 2 and 3 and propagate only the video of server 2', async function () { 222 it('Should upload a video on server 2 and 3 and propagate only the video of server 2', async function () {
@@ -310,15 +309,15 @@ describe('Test follows', function () {
310 }) 309 })
311 310
312 it('Should have the correct follows counts 3', async function () { 311 it('Should have the correct follows counts 3', async function () {
313 await expectAccountFollows(servers[0].url, 'peertube@localhost:9001', 0, 2) 312 await expectAccountFollows(servers[0].url, 'peertube@localhost:' + servers[0].port, 0, 2)
314 await expectAccountFollows(servers[0].url, 'peertube@localhost:9002', 1, 0) 313 await expectAccountFollows(servers[0].url, 'peertube@localhost:' + servers[1].port, 1, 0)
315 await expectAccountFollows(servers[0].url, 'peertube@localhost:9003', 1, 0) 314 await expectAccountFollows(servers[0].url, 'peertube@localhost:' + servers[2].port, 1, 0)
316 315
317 await expectAccountFollows(servers[1].url, 'peertube@localhost:9001', 0, 1) 316 await expectAccountFollows(servers[1].url, 'peertube@localhost:' + servers[0].port, 0, 1)
318 await expectAccountFollows(servers[1].url, 'peertube@localhost:9002', 1, 0) 317 await expectAccountFollows(servers[1].url, 'peertube@localhost:' + servers[1].port, 1, 0)
319 318
320 await expectAccountFollows(servers[2].url, 'peertube@localhost:9001', 0, 2) 319 await expectAccountFollows(servers[2].url, 'peertube@localhost:' + servers[0].port, 0, 2)
321 await expectAccountFollows(servers[2].url, 'peertube@localhost:9003', 1, 0) 320 await expectAccountFollows(servers[2].url, 'peertube@localhost:' + servers[2].port, 1, 0)
322 }) 321 })
323 322
324 it('Should have propagated videos', async function () { 323 it('Should have propagated videos', async function () {
@@ -344,7 +343,7 @@ describe('Test follows', function () {
344 support: 'my super support text', 343 support: 'my super support text',
345 account: { 344 account: {
346 name: 'root', 345 name: 'root',
347 host: 'localhost:9003' 346 host: 'localhost:' + servers[2].port
348 }, 347 },
349 isLocal, 348 isLocal,
350 commentsEnabled: true, 349 commentsEnabled: true,
@@ -384,7 +383,7 @@ describe('Test follows', function () {
384 expect(comment.videoId).to.equal(video4.id) 383 expect(comment.videoId).to.equal(video4.id)
385 expect(comment.id).to.equal(comment.threadId) 384 expect(comment.id).to.equal(comment.threadId)
386 expect(comment.account.name).to.equal('root') 385 expect(comment.account.name).to.equal('root')
387 expect(comment.account.host).to.equal('localhost:9003') 386 expect(comment.account.host).to.equal('localhost:' + servers[2].port)
388 expect(comment.totalReplies).to.equal(3) 387 expect(comment.totalReplies).to.equal(3)
389 expect(dateIsValid(comment.createdAt as string)).to.be.true 388 expect(dateIsValid(comment.createdAt as string)).to.be.true
390 expect(dateIsValid(comment.updatedAt as string)).to.be.true 389 expect(dateIsValid(comment.updatedAt as string)).to.be.true
diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.ts
index 19010dbc1..9a8bc08f9 100644
--- a/server/tests/api/server/handle-down.ts
+++ b/server/tests/api/server/handle-down.ts
@@ -70,7 +70,7 @@ describe('Test handle downs', function () {
70 support: 'my super support text for server 1', 70 support: 'my super support text for server 1',
71 account: { 71 account: {
72 name: 'root', 72 name: 'root',
73 host: 'localhost:9001' 73 host: 'localhost:' + servers[0].port
74 }, 74 },
75 isLocal: false, 75 isLocal: false,
76 duration: 10, 76 duration: 10,
@@ -172,7 +172,7 @@ describe('Test handle downs', function () {
172 const res = await getFollowersListPaginationAndSort(servers[0].url, 0, 2, 'createdAt') 172 const res = await getFollowersListPaginationAndSort(servers[0].url, 0, 2, 'createdAt')
173 expect(res.body.data).to.be.an('array') 173 expect(res.body.data).to.be.an('array')
174 expect(res.body.data).to.have.lengthOf(1) 174 expect(res.body.data).to.have.lengthOf(1)
175 expect(res.body.data[0].follower.host).to.equal('localhost:9003') 175 expect(res.body.data[0].follower.host).to.equal('localhost:' + servers[2].port)
176 }) 176 })
177 177
178 it('Should not have pending/processing jobs anymore', async function () { 178 it('Should not have pending/processing jobs anymore', async function () {
diff --git a/server/tests/api/travis-1.sh b/server/tests/api/travis-1.sh
index e4761d2f9..0673bb2bf 100644
--- a/server/tests/api/travis-1.sh
+++ b/server/tests/api/travis-1.sh
@@ -2,9 +2,9 @@
2 2
3set -eu 3set -eu
4 4
5files=$(find server/tests/api/check-params -type f | grep -v index.ts | xargs echo) 5notificationsFiles=$(find server/tests/api/notifications -type f | grep -v index.ts | xargs echo)
6searchFiles=$(find server/tests/api/search -type f | grep -v index.ts | xargs echo)
7checkParamFiles=$(find server/tests/api/check-params -type f | grep -v index.ts | xargs echo)
6 8
7MOCHA_PARALLEL=true mocha-parallel-tests --max-parallel 4 --timeout 5000 --exit --require ts-node/register --bail $files 9MOCHA_PARALLEL=true mocha-parallel-tests --max-parallel 4 --timeout 5000 --exit --require ts-node/register --bail \
8 10 $notificationsFiles $searchFiles $checkParamFiles
9mocha --timeout 5000 --exit --require ts-node/register --bail server/tests/api/notifications/index.ts
10mocha --timeout 5000 --exit --require ts-node/register --bail server/tests/api/search/index.ts
diff --git a/server/tests/api/users/blocklist.ts b/server/tests/api/users/blocklist.ts
index fbc57e0ef..c25e85ada 100644
--- a/server/tests/api/users/blocklist.ts
+++ b/server/tests/api/users/blocklist.ts
@@ -144,7 +144,7 @@ describe('Test blocklist', function () {
144 }) 144 })
145 145
146 it('Should block a remote account', async function () { 146 it('Should block a remote account', async function () {
147 await addAccountToAccountBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'user2@localhost:9002') 147 await addAccountToAccountBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'user2@localhost:' + servers[1].port)
148 }) 148 })
149 149
150 it('Should hide its videos', async function () { 150 it('Should hide its videos', async function () {
@@ -209,7 +209,7 @@ describe('Test blocklist', function () {
209 expect(block.byAccount.name).to.equal('root') 209 expect(block.byAccount.name).to.equal('root')
210 expect(block.blockedAccount.displayName).to.equal('user2') 210 expect(block.blockedAccount.displayName).to.equal('user2')
211 expect(block.blockedAccount.name).to.equal('user2') 211 expect(block.blockedAccount.name).to.equal('user2')
212 expect(block.blockedAccount.host).to.equal('localhost:9002') 212 expect(block.blockedAccount.host).to.equal('localhost:' + servers[1].port)
213 } 213 }
214 214
215 { 215 {
@@ -223,12 +223,12 @@ describe('Test blocklist', function () {
223 expect(block.byAccount.name).to.equal('root') 223 expect(block.byAccount.name).to.equal('root')
224 expect(block.blockedAccount.displayName).to.equal('user1') 224 expect(block.blockedAccount.displayName).to.equal('user1')
225 expect(block.blockedAccount.name).to.equal('user1') 225 expect(block.blockedAccount.name).to.equal('user1')
226 expect(block.blockedAccount.host).to.equal('localhost:9001') 226 expect(block.blockedAccount.host).to.equal('localhost:' + servers[0].port)
227 } 227 }
228 }) 228 })
229 229
230 it('Should unblock the remote account', async function () { 230 it('Should unblock the remote account', async function () {
231 await removeAccountFromAccountBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'user2@localhost:9002') 231 await removeAccountFromAccountBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'user2@localhost:' + servers[1].port)
232 }) 232 })
233 233
234 it('Should display its videos', async function () { 234 it('Should display its videos', async function () {
@@ -260,7 +260,7 @@ describe('Test blocklist', function () {
260 }) 260 })
261 261
262 it('Should block a remote server', async function () { 262 it('Should block a remote server', async function () {
263 await addServerToAccountBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'localhost:9002') 263 await addServerToAccountBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'localhost:' + servers[1].port)
264 }) 264 })
265 265
266 it('Should hide its videos', async function () { 266 it('Should hide its videos', async function () {
@@ -291,11 +291,11 @@ describe('Test blocklist', function () {
291 const block = blocks[ 0 ] 291 const block = blocks[ 0 ]
292 expect(block.byAccount.displayName).to.equal('root') 292 expect(block.byAccount.displayName).to.equal('root')
293 expect(block.byAccount.name).to.equal('root') 293 expect(block.byAccount.name).to.equal('root')
294 expect(block.blockedServer.host).to.equal('localhost:9002') 294 expect(block.blockedServer.host).to.equal('localhost:' + servers[1].port)
295 }) 295 })
296 296
297 it('Should unblock the remote server', async function () { 297 it('Should unblock the remote server', async function () {
298 await removeServerFromAccountBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'localhost:9002') 298 await removeServerFromAccountBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'localhost:' + servers[1].port)
299 }) 299 })
300 300
301 it('Should display its videos', function () { 301 it('Should display its videos', function () {
@@ -324,7 +324,7 @@ describe('Test blocklist', function () {
324 }) 324 })
325 325
326 it('Should block a remote account', async function () { 326 it('Should block a remote account', async function () {
327 await addAccountToServerBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'user2@localhost:9002') 327 await addAccountToServerBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'user2@localhost:' + servers[1].port)
328 }) 328 })
329 329
330 it('Should hide its videos', async function () { 330 it('Should hide its videos', async function () {
@@ -387,7 +387,7 @@ describe('Test blocklist', function () {
387 expect(block.byAccount.name).to.equal('peertube') 387 expect(block.byAccount.name).to.equal('peertube')
388 expect(block.blockedAccount.displayName).to.equal('user2') 388 expect(block.blockedAccount.displayName).to.equal('user2')
389 expect(block.blockedAccount.name).to.equal('user2') 389 expect(block.blockedAccount.name).to.equal('user2')
390 expect(block.blockedAccount.host).to.equal('localhost:9002') 390 expect(block.blockedAccount.host).to.equal('localhost:' + servers[1].port)
391 } 391 }
392 392
393 { 393 {
@@ -401,12 +401,12 @@ describe('Test blocklist', function () {
401 expect(block.byAccount.name).to.equal('peertube') 401 expect(block.byAccount.name).to.equal('peertube')
402 expect(block.blockedAccount.displayName).to.equal('user1') 402 expect(block.blockedAccount.displayName).to.equal('user1')
403 expect(block.blockedAccount.name).to.equal('user1') 403 expect(block.blockedAccount.name).to.equal('user1')
404 expect(block.blockedAccount.host).to.equal('localhost:9001') 404 expect(block.blockedAccount.host).to.equal('localhost:' + servers[0].port)
405 } 405 }
406 }) 406 })
407 407
408 it('Should unblock the remote account', async function () { 408 it('Should unblock the remote account', async function () {
409 await removeAccountFromServerBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'user2@localhost:9002') 409 await removeAccountFromServerBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'user2@localhost:' + servers[1].port)
410 }) 410 })
411 411
412 it('Should display its videos', async function () { 412 it('Should display its videos', async function () {
@@ -446,7 +446,7 @@ describe('Test blocklist', function () {
446 }) 446 })
447 447
448 it('Should block a remote server', async function () { 448 it('Should block a remote server', async function () {
449 await addServerToServerBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'localhost:9002') 449 await addServerToServerBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'localhost:' + servers[1].port)
450 }) 450 })
451 451
452 it('Should hide its videos', async function () { 452 it('Should hide its videos', async function () {
@@ -478,11 +478,11 @@ describe('Test blocklist', function () {
478 const block = blocks[ 0 ] 478 const block = blocks[ 0 ]
479 expect(block.byAccount.displayName).to.equal('peertube') 479 expect(block.byAccount.displayName).to.equal('peertube')
480 expect(block.byAccount.name).to.equal('peertube') 480 expect(block.byAccount.name).to.equal('peertube')
481 expect(block.blockedServer.host).to.equal('localhost:9002') 481 expect(block.blockedServer.host).to.equal('localhost:' + servers[1].port)
482 }) 482 })
483 483
484 it('Should unblock the remote server', async function () { 484 it('Should unblock the remote server', async function () {
485 await removeServerFromServerBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'localhost:9002') 485 await removeServerFromServerBlocklist(servers[ 0 ].url, servers[ 0 ].accessToken, 'localhost:' + servers[1].port)
486 }) 486 })
487 487
488 it('Should list all videos', async function () { 488 it('Should list all videos', async function () {
diff --git a/server/tests/api/users/users-verification.ts b/server/tests/api/users/users-verification.ts
index 514acf2e7..3b37a26cf 100644
--- a/server/tests/api/users/users-verification.ts
+++ b/server/tests/api/users/users-verification.ts
@@ -30,11 +30,12 @@ describe('Test users account verification', function () {
30 before(async function () { 30 before(async function () {
31 this.timeout(30000) 31 this.timeout(30000)
32 32
33 await MockSmtpServer.Instance.collectEmails(emails) 33 const port = await MockSmtpServer.Instance.collectEmails(emails)
34 34
35 const overrideConfig = { 35 const overrideConfig = {
36 smtp: { 36 smtp: {
37 hostname: 'localhost' 37 hostname: 'localhost',
38 port
38 } 39 }
39 } 40 }
40 server = await flushAndRunServer(1, overrideConfig) 41 server = await flushAndRunServer(1, overrideConfig)
diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts
index 68c1e9a8d..89904759a 100644
--- a/server/tests/api/videos/multiple-servers.ts
+++ b/server/tests/api/videos/multiple-servers.ts
@@ -9,18 +9,17 @@ import { VideoComment, VideoCommentThreadTree } from '../../../../shared/models/
9import { 9import {
10 addVideoChannel, 10 addVideoChannel,
11 checkTmpIsEmpty, 11 checkTmpIsEmpty,
12 checkVideoFilesWereRemoved, cleanupTests, 12 checkVideoFilesWereRemoved,
13 cleanupTests,
13 completeVideoCheck, 14 completeVideoCheck,
14 createUser, 15 createUser,
15 dateIsValid, 16 dateIsValid,
16 doubleFollow, 17 doubleFollow,
17 flushAndRunMultipleServers, 18 flushAndRunMultipleServers,
18 flushTests,
19 getLocalVideos, 19 getLocalVideos,
20 getVideo, 20 getVideo,
21 getVideoChannelsList, 21 getVideoChannelsList,
22 getVideosList, 22 getVideosList,
23 killallServers,
24 rateVideo, 23 rateVideo,
25 removeVideo, 24 removeVideo,
26 ServerInfo, 25 ServerInfo,
@@ -110,7 +109,7 @@ describe('Test multiple servers', function () {
110 // All servers should have this video 109 // All servers should have this video
111 let publishedAt: string = null 110 let publishedAt: string = null
112 for (const server of servers) { 111 for (const server of servers) {
113 const isLocal = server.url === 'http://localhost:9001' 112 const isLocal = server.url === 'http://localhost:' + servers[0].port
114 const checkAttributes = { 113 const checkAttributes = {
115 name: 'my super name for server 1', 114 name: 'my super name for server 1',
116 category: 5, 115 category: 5,
@@ -122,7 +121,7 @@ describe('Test multiple servers', function () {
122 originallyPublishedAt: '2019-02-10T13:38:14.449Z', 121 originallyPublishedAt: '2019-02-10T13:38:14.449Z',
123 account: { 122 account: {
124 name: 'root', 123 name: 'root',
125 host: 'localhost:9001' 124 host: 'localhost:' + servers[0].port
126 }, 125 },
127 isLocal, 126 isLocal,
128 publishedAt, 127 publishedAt,
@@ -187,7 +186,7 @@ describe('Test multiple servers', function () {
187 186
188 // All servers should have this video 187 // All servers should have this video
189 for (const server of servers) { 188 for (const server of servers) {
190 const isLocal = server.url === 'http://localhost:9002' 189 const isLocal = server.url === 'http://localhost:' + servers[1].port
191 const checkAttributes = { 190 const checkAttributes = {
192 name: 'my super name for server 2', 191 name: 'my super name for server 2',
193 category: 4, 192 category: 4,
@@ -198,7 +197,7 @@ describe('Test multiple servers', function () {
198 support: 'my super support text for server 2', 197 support: 'my super support text for server 2',
199 account: { 198 account: {
200 name: 'user1', 199 name: 'user1',
201 host: 'localhost:9002' 200 host: 'localhost:' + servers[1].port
202 }, 201 },
203 isLocal, 202 isLocal,
204 commentsEnabled: true, 203 commentsEnabled: true,
@@ -278,7 +277,7 @@ describe('Test multiple servers', function () {
278 277
279 // All servers should have this video 278 // All servers should have this video
280 for (const server of servers) { 279 for (const server of servers) {
281 const isLocal = server.url === 'http://localhost:9003' 280 const isLocal = server.url === 'http://localhost:' + servers[2].port
282 const res = await getVideosList(server.url) 281 const res = await getVideosList(server.url)
283 282
284 const videos = res.body.data 283 const videos = res.body.data
@@ -306,7 +305,7 @@ describe('Test multiple servers', function () {
306 support: 'my super support text for server 3', 305 support: 'my super support text for server 3',
307 account: { 306 account: {
308 name: 'root', 307 name: 'root',
309 host: 'localhost:9003' 308 host: 'localhost:' + servers[2].port
310 }, 309 },
311 isLocal, 310 isLocal,
312 duration: 5, 311 duration: 5,
@@ -340,7 +339,7 @@ describe('Test multiple servers', function () {
340 support: 'my super support text for server 3-2', 339 support: 'my super support text for server 3-2',
341 account: { 340 account: {
342 name: 'root', 341 name: 'root',
343 host: 'localhost:9003' 342 host: 'localhost:' + servers[2].port
344 }, 343 },
345 commentsEnabled: true, 344 commentsEnabled: true,
346 downloadEnabled: true, 345 downloadEnabled: true,
@@ -646,7 +645,7 @@ describe('Test multiple servers', function () {
646 const videoUpdated = videos.find(video => video.name === 'my super video updated') 645 const videoUpdated = videos.find(video => video.name === 'my super video updated')
647 expect(!!videoUpdated).to.be.true 646 expect(!!videoUpdated).to.be.true
648 647
649 const isLocal = server.url === 'http://localhost:9003' 648 const isLocal = server.url === 'http://localhost:' + servers[2].port
650 const checkAttributes = { 649 const checkAttributes = {
651 name: 'my super video updated', 650 name: 'my super video updated',
652 category: 10, 651 category: 10,
@@ -658,7 +657,7 @@ describe('Test multiple servers', function () {
658 originallyPublishedAt: '2019-02-11T13:38:14.449Z', 657 originallyPublishedAt: '2019-02-11T13:38:14.449Z',
659 account: { 658 account: {
660 name: 'root', 659 name: 'root',
661 host: 'localhost:9003' 660 host: 'localhost:' + servers[2].port
662 }, 661 },
663 isLocal, 662 isLocal,
664 duration: 5, 663 duration: 5,
@@ -813,7 +812,7 @@ describe('Test multiple servers', function () {
813 expect(comment).to.not.be.undefined 812 expect(comment).to.not.be.undefined
814 expect(comment.inReplyToCommentId).to.be.null 813 expect(comment.inReplyToCommentId).to.be.null
815 expect(comment.account.name).to.equal('root') 814 expect(comment.account.name).to.equal('root')
816 expect(comment.account.host).to.equal('localhost:9001') 815 expect(comment.account.host).to.equal('localhost:' + servers[0].port)
817 expect(comment.totalReplies).to.equal(3) 816 expect(comment.totalReplies).to.equal(3)
818 expect(dateIsValid(comment.createdAt as string)).to.be.true 817 expect(dateIsValid(comment.createdAt as string)).to.be.true
819 expect(dateIsValid(comment.updatedAt as string)).to.be.true 818 expect(dateIsValid(comment.updatedAt as string)).to.be.true
@@ -824,7 +823,7 @@ describe('Test multiple servers', function () {
824 expect(comment).to.not.be.undefined 823 expect(comment).to.not.be.undefined
825 expect(comment.inReplyToCommentId).to.be.null 824 expect(comment.inReplyToCommentId).to.be.null
826 expect(comment.account.name).to.equal('root') 825 expect(comment.account.name).to.equal('root')
827 expect(comment.account.host).to.equal('localhost:9003') 826 expect(comment.account.host).to.equal('localhost:' + servers[2].port)
828 expect(comment.totalReplies).to.equal(0) 827 expect(comment.totalReplies).to.equal(0)
829 expect(dateIsValid(comment.createdAt as string)).to.be.true 828 expect(dateIsValid(comment.createdAt as string)).to.be.true
830 expect(dateIsValid(comment.updatedAt as string)).to.be.true 829 expect(dateIsValid(comment.updatedAt as string)).to.be.true
@@ -842,25 +841,25 @@ describe('Test multiple servers', function () {
842 const tree: VideoCommentThreadTree = res2.body 841 const tree: VideoCommentThreadTree = res2.body
843 expect(tree.comment.text).equal('my super first comment') 842 expect(tree.comment.text).equal('my super first comment')
844 expect(tree.comment.account.name).equal('root') 843 expect(tree.comment.account.name).equal('root')
845 expect(tree.comment.account.host).equal('localhost:9001') 844 expect(tree.comment.account.host).equal('localhost:' + servers[0].port)
846 expect(tree.children).to.have.lengthOf(2) 845 expect(tree.children).to.have.lengthOf(2)
847 846
848 const firstChild = tree.children[0] 847 const firstChild = tree.children[0]
849 expect(firstChild.comment.text).to.equal('my super answer to thread 1') 848 expect(firstChild.comment.text).to.equal('my super answer to thread 1')
850 expect(firstChild.comment.account.name).equal('root') 849 expect(firstChild.comment.account.name).equal('root')
851 expect(firstChild.comment.account.host).equal('localhost:9002') 850 expect(firstChild.comment.account.host).equal('localhost:' + servers[1].port)
852 expect(firstChild.children).to.have.lengthOf(1) 851 expect(firstChild.children).to.have.lengthOf(1)
853 852
854 childOfFirstChild = firstChild.children[0] 853 childOfFirstChild = firstChild.children[0]
855 expect(childOfFirstChild.comment.text).to.equal('my super answer to answer of thread 1') 854 expect(childOfFirstChild.comment.text).to.equal('my super answer to answer of thread 1')
856 expect(childOfFirstChild.comment.account.name).equal('root') 855 expect(childOfFirstChild.comment.account.name).equal('root')
857 expect(childOfFirstChild.comment.account.host).equal('localhost:9003') 856 expect(childOfFirstChild.comment.account.host).equal('localhost:' + servers[2].port)
858 expect(childOfFirstChild.children).to.have.lengthOf(0) 857 expect(childOfFirstChild.children).to.have.lengthOf(0)
859 858
860 const secondChild = tree.children[1] 859 const secondChild = tree.children[1]
861 expect(secondChild.comment.text).to.equal('my second answer to thread 1') 860 expect(secondChild.comment.text).to.equal('my second answer to thread 1')
862 expect(secondChild.comment.account.name).equal('root') 861 expect(secondChild.comment.account.name).equal('root')
863 expect(secondChild.comment.account.host).equal('localhost:9003') 862 expect(secondChild.comment.account.host).equal('localhost:' + servers[2].port)
864 expect(secondChild.children).to.have.lengthOf(0) 863 expect(secondChild.children).to.have.lengthOf(0)
865 } 864 }
866 }) 865 })
@@ -915,7 +914,7 @@ describe('Test multiple servers', function () {
915 expect(comment).to.not.be.undefined 914 expect(comment).to.not.be.undefined
916 expect(comment.inReplyToCommentId).to.be.null 915 expect(comment.inReplyToCommentId).to.be.null
917 expect(comment.account.name).to.equal('root') 916 expect(comment.account.name).to.equal('root')
918 expect(comment.account.host).to.equal('localhost:9003') 917 expect(comment.account.host).to.equal('localhost:' + servers[2].port)
919 expect(comment.totalReplies).to.equal(0) 918 expect(comment.totalReplies).to.equal(0)
920 expect(dateIsValid(comment.createdAt as string)).to.be.true 919 expect(dateIsValid(comment.createdAt as string)).to.be.true
921 expect(dateIsValid(comment.updatedAt as string)).to.be.true 920 expect(dateIsValid(comment.updatedAt as string)).to.be.true
@@ -971,7 +970,7 @@ describe('Test multiple servers', function () {
971 const res = await getVideosList(server.url) 970 const res = await getVideosList(server.url)
972 const video = res.body.data.find(v => v.name === 'minimum parameters') 971 const video = res.body.data.find(v => v.name === 'minimum parameters')
973 972
974 const isLocal = server.url === 'http://localhost:9002' 973 const isLocal = server.url === 'http://localhost:' + servers[1].port
975 const checkAttributes = { 974 const checkAttributes = {
976 name: 'minimum parameters', 975 name: 'minimum parameters',
977 category: null, 976 category: null,
@@ -982,7 +981,7 @@ describe('Test multiple servers', function () {
982 support: null, 981 support: null,
983 account: { 982 account: {
984 name: 'root', 983 name: 'root',
985 host: 'localhost:9002' 984 host: 'localhost:' + servers[1].port
986 }, 985 },
987 isLocal, 986 isLocal,
988 duration: 5, 987 duration: 5,
diff --git a/server/tests/api/videos/services.ts b/server/tests/api/videos/services.ts
index e9ad947b2..38e232e5f 100644
--- a/server/tests/api/videos/services.ts
+++ b/server/tests/api/videos/services.ts
@@ -27,13 +27,13 @@ describe('Test services', function () {
27 }) 27 })
28 28
29 it('Should have a valid oEmbed response', async function () { 29 it('Should have a valid oEmbed response', async function () {
30 const oembedUrl = 'http://localhost:9001/videos/watch/' + server.video.uuid 30 const oembedUrl = 'http://localhost:' + server.port + '/videos/watch/' + server.video.uuid
31 31
32 const res = await getOEmbed(server.url, oembedUrl) 32 const res = await getOEmbed(server.url, oembedUrl)
33 const expectedHtml = '<iframe width="560" height="315" sandbox="allow-same-origin allow-scripts" ' + 33 const expectedHtml = '<iframe width="560" height="315" sandbox="allow-same-origin allow-scripts" ' +
34 `src="http://localhost:9001/videos/embed/${server.video.uuid}" ` + 34 `src="http://localhost:${server.port}/videos/embed/${server.video.uuid}" ` +
35 'frameborder="0" allowfullscreen></iframe>' 35 'frameborder="0" allowfullscreen></iframe>'
36 const expectedThumbnailUrl = 'http://localhost:9001/static/previews/' + server.video.uuid + '.jpg' 36 const expectedThumbnailUrl = 'http://localhost:' + server.port + '/static/previews/' + server.video.uuid + '.jpg'
37 37
38 expect(res.body.html).to.equal(expectedHtml) 38 expect(res.body.html).to.equal(expectedHtml)
39 expect(res.body.title).to.equal(server.video.name) 39 expect(res.body.title).to.equal(server.video.name)
@@ -46,14 +46,14 @@ describe('Test services', function () {
46 }) 46 })
47 47
48 it('Should have a valid oEmbed response with small max height query', async function () { 48 it('Should have a valid oEmbed response with small max height query', async function () {
49 const oembedUrl = 'http://localhost:9001/videos/watch/' + server.video.uuid 49 const oembedUrl = 'http://localhost:' + server.port + '/videos/watch/' + server.video.uuid
50 const format = 'json' 50 const format = 'json'
51 const maxHeight = 50 51 const maxHeight = 50
52 const maxWidth = 50 52 const maxWidth = 50
53 53
54 const res = await getOEmbed(server.url, oembedUrl, format, maxHeight, maxWidth) 54 const res = await getOEmbed(server.url, oembedUrl, format, maxHeight, maxWidth)
55 const expectedHtml = '<iframe width="50" height="50" sandbox="allow-same-origin allow-scripts" ' + 55 const expectedHtml = '<iframe width="50" height="50" sandbox="allow-same-origin allow-scripts" ' +
56 `src="http://localhost:9001/videos/embed/${server.video.uuid}" ` + 56 `src="http://localhost:${server.port}/videos/embed/${server.video.uuid}" ` +
57 'frameborder="0" allowfullscreen></iframe>' 57 'frameborder="0" allowfullscreen></iframe>'
58 58
59 expect(res.body.html).to.equal(expectedHtml) 59 expect(res.body.html).to.equal(expectedHtml)
diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts
index 1f366b642..b0412f4df 100644
--- a/server/tests/api/videos/single-server.ts
+++ b/server/tests/api/videos/single-server.ts
@@ -47,7 +47,7 @@ describe('Test a single server', function () {
47 support: 'my super support text', 47 support: 'my super support text',
48 account: { 48 account: {
49 name: 'root', 49 name: 'root',
50 host: 'localhost:9001' 50 host: 'localhost:' + server.port
51 }, 51 },
52 isLocal: true, 52 isLocal: true,
53 duration: 5, 53 duration: 5,
@@ -80,7 +80,7 @@ describe('Test a single server', function () {
80 support: 'my super support text updated', 80 support: 'my super support text updated',
81 account: { 81 account: {
82 name: 'root', 82 name: 'root',
83 host: 'localhost:9001' 83 host: 'localhost:' + server.port
84 }, 84 },
85 isLocal: true, 85 isLocal: true,
86 tags: [ 'tagup1', 'tagup2' ], 86 tags: [ 'tagup1', 'tagup2' ],
diff --git a/server/tests/api/videos/video-abuse.ts b/server/tests/api/videos/video-abuse.ts
index 7318497d5..a2f3ee161 100644
--- a/server/tests/api/videos/video-abuse.ts
+++ b/server/tests/api/videos/video-abuse.ts
@@ -9,7 +9,6 @@ import {
9 flushAndRunMultipleServers, 9 flushAndRunMultipleServers,
10 getVideoAbusesList, 10 getVideoAbusesList,
11 getVideosList, 11 getVideosList,
12 killallServers,
13 reportVideoAbuse, 12 reportVideoAbuse,
14 ServerInfo, 13 ServerInfo,
15 setAccessTokensToServers, 14 setAccessTokensToServers,
@@ -90,7 +89,7 @@ describe('Test video abuses', function () {
90 const abuse: VideoAbuse = res1.body.data[0] 89 const abuse: VideoAbuse = res1.body.data[0]
91 expect(abuse.reason).to.equal('my super bad reason') 90 expect(abuse.reason).to.equal('my super bad reason')
92 expect(abuse.reporterAccount.name).to.equal('root') 91 expect(abuse.reporterAccount.name).to.equal('root')
93 expect(abuse.reporterAccount.host).to.equal('localhost:9001') 92 expect(abuse.reporterAccount.host).to.equal('localhost:' + servers[0].port)
94 expect(abuse.video.id).to.equal(servers[0].video.id) 93 expect(abuse.video.id).to.equal(servers[0].video.id)
95 94
96 const res2 = await getVideoAbusesList(servers[1].url, servers[1].accessToken) 95 const res2 = await getVideoAbusesList(servers[1].url, servers[1].accessToken)
@@ -118,7 +117,7 @@ describe('Test video abuses', function () {
118 const abuse1: VideoAbuse = res1.body.data[0] 117 const abuse1: VideoAbuse = res1.body.data[0]
119 expect(abuse1.reason).to.equal('my super bad reason') 118 expect(abuse1.reason).to.equal('my super bad reason')
120 expect(abuse1.reporterAccount.name).to.equal('root') 119 expect(abuse1.reporterAccount.name).to.equal('root')
121 expect(abuse1.reporterAccount.host).to.equal('localhost:9001') 120 expect(abuse1.reporterAccount.host).to.equal('localhost:' + servers[0].port)
122 expect(abuse1.video.id).to.equal(servers[0].video.id) 121 expect(abuse1.video.id).to.equal(servers[0].video.id)
123 expect(abuse1.state.id).to.equal(VideoAbuseState.PENDING) 122 expect(abuse1.state.id).to.equal(VideoAbuseState.PENDING)
124 expect(abuse1.state.label).to.equal('Pending') 123 expect(abuse1.state.label).to.equal('Pending')
@@ -127,7 +126,7 @@ describe('Test video abuses', function () {
127 const abuse2: VideoAbuse = res1.body.data[1] 126 const abuse2: VideoAbuse = res1.body.data[1]
128 expect(abuse2.reason).to.equal('my super bad reason 2') 127 expect(abuse2.reason).to.equal('my super bad reason 2')
129 expect(abuse2.reporterAccount.name).to.equal('root') 128 expect(abuse2.reporterAccount.name).to.equal('root')
130 expect(abuse2.reporterAccount.host).to.equal('localhost:9001') 129 expect(abuse2.reporterAccount.host).to.equal('localhost:' + servers[0].port)
131 expect(abuse2.video.id).to.equal(servers[1].video.id) 130 expect(abuse2.video.id).to.equal(servers[1].video.id)
132 expect(abuse2.state.id).to.equal(VideoAbuseState.PENDING) 131 expect(abuse2.state.id).to.equal(VideoAbuseState.PENDING)
133 expect(abuse2.state.label).to.equal('Pending') 132 expect(abuse2.state.label).to.equal('Pending')
@@ -141,7 +140,7 @@ describe('Test video abuses', function () {
141 abuseServer2 = res2.body.data[0] 140 abuseServer2 = res2.body.data[0]
142 expect(abuseServer2.reason).to.equal('my super bad reason 2') 141 expect(abuseServer2.reason).to.equal('my super bad reason 2')
143 expect(abuseServer2.reporterAccount.name).to.equal('root') 142 expect(abuseServer2.reporterAccount.name).to.equal('root')
144 expect(abuseServer2.reporterAccount.host).to.equal('localhost:9001') 143 expect(abuseServer2.reporterAccount.host).to.equal('localhost:' + servers[0].port)
145 expect(abuseServer2.state.id).to.equal(VideoAbuseState.PENDING) 144 expect(abuseServer2.state.id).to.equal(VideoAbuseState.PENDING)
146 expect(abuseServer2.state.label).to.equal('Pending') 145 expect(abuseServer2.state.label).to.equal('Pending')
147 expect(abuseServer2.moderationComment).to.be.null 146 expect(abuseServer2.moderationComment).to.be.null
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts
index 345e96f43..f09148404 100644
--- a/server/tests/api/videos/video-channels.ts
+++ b/server/tests/api/videos/video-channels.ts
@@ -213,7 +213,7 @@ describe('Test video channels', function () {
213 this.timeout(10000) 213 this.timeout(10000)
214 214
215 for (const server of servers) { 215 for (const server of servers) {
216 const channelURI = 'second_video_channel@localhost:9001' 216 const channelURI = 'second_video_channel@localhost:' + server.port
217 const res1 = await getVideoChannelVideos(server.url, server.accessToken, channelURI, 0, 5) 217 const res1 = await getVideoChannelVideos(server.url, server.accessToken, channelURI, 0, 5)
218 expect(res1.body.total).to.equal(1) 218 expect(res1.body.total).to.equal(1)
219 expect(res1.body.data).to.be.an('array') 219 expect(res1.body.data).to.be.an('array')
@@ -234,11 +234,11 @@ describe('Test video channels', function () {
234 this.timeout(10000) 234 this.timeout(10000)
235 235
236 for (const server of servers) { 236 for (const server of servers) {
237 const secondChannelURI = 'second_video_channel@localhost:9001' 237 const secondChannelURI = 'second_video_channel@localhost:' + server.port
238 const res1 = await getVideoChannelVideos(server.url, server.accessToken, secondChannelURI, 0, 5) 238 const res1 = await getVideoChannelVideos(server.url, server.accessToken, secondChannelURI, 0, 5)
239 expect(res1.body.total).to.equal(0) 239 expect(res1.body.total).to.equal(0)
240 240
241 const channelURI = 'root_channel@localhost:9001' 241 const channelURI = 'root_channel@localhost:' + server.port
242 const res2 = await getVideoChannelVideos(server.url, server.accessToken, channelURI, 0, 5) 242 const res2 = await getVideoChannelVideos(server.url, server.accessToken, channelURI, 0, 5)
243 expect(res2.body.total).to.equal(1) 243 expect(res2.body.total).to.equal(1)
244 244
diff --git a/server/tests/api/videos/video-comments.ts b/server/tests/api/videos/video-comments.ts
index 22fd8c058..82182cc7c 100644
--- a/server/tests/api/videos/video-comments.ts
+++ b/server/tests/api/videos/video-comments.ts
@@ -66,8 +66,8 @@ describe('Test video comments', function () {
66 expect(comment.videoId).to.equal(videoId) 66 expect(comment.videoId).to.equal(videoId)
67 expect(comment.id).to.equal(comment.threadId) 67 expect(comment.id).to.equal(comment.threadId)
68 expect(comment.account.name).to.equal('root') 68 expect(comment.account.name).to.equal('root')
69 expect(comment.account.host).to.equal('localhost:9001') 69 expect(comment.account.host).to.equal('localhost:' + server.port)
70 expect(comment.account.url).to.equal('http://localhost:9001/accounts/root') 70 expect(comment.account.url).to.equal('http://localhost:' + server.port + '/accounts/root')
71 expect(comment.totalReplies).to.equal(0) 71 expect(comment.totalReplies).to.equal(0)
72 expect(dateIsValid(comment.createdAt as string)).to.be.true 72 expect(dateIsValid(comment.createdAt as string)).to.be.true
73 expect(dateIsValid(comment.updatedAt as string)).to.be.true 73 expect(dateIsValid(comment.updatedAt as string)).to.be.true
@@ -86,7 +86,7 @@ describe('Test video comments', function () {
86 expect(comment.videoId).to.equal(videoId) 86 expect(comment.videoId).to.equal(videoId)
87 expect(comment.id).to.equal(comment.threadId) 87 expect(comment.id).to.equal(comment.threadId)
88 expect(comment.account.name).to.equal('root') 88 expect(comment.account.name).to.equal('root')
89 expect(comment.account.host).to.equal('localhost:9001') 89 expect(comment.account.host).to.equal('localhost:' + server.port)
90 90
91 await testImage(server.url, 'avatar-resized', comment.account.avatar.path, '.png') 91 await testImage(server.url, 'avatar-resized', comment.account.avatar.path, '.png')
92 92
diff --git a/server/tests/api/videos/video-hls.ts b/server/tests/api/videos/video-hls.ts
index 22031c18b..4565d0ebe 100644
--- a/server/tests/api/videos/video-hls.ts
+++ b/server/tests/api/videos/video-hls.ts
@@ -5,13 +5,12 @@ import 'mocha'
5import { 5import {
6 checkDirectoryIsEmpty, 6 checkDirectoryIsEmpty,
7 checkSegmentHash, 7 checkSegmentHash,
8 checkTmpIsEmpty, cleanupTests, 8 checkTmpIsEmpty,
9 cleanupTests,
9 doubleFollow, 10 doubleFollow,
10 flushAndRunMultipleServers, 11 flushAndRunMultipleServers,
11 flushTests,
12 getPlaylist, 12 getPlaylist,
13 getVideo, 13 getVideo,
14 killallServers,
15 removeVideo, 14 removeVideo,
16 ServerInfo, 15 ServerInfo,
17 setAccessTokensToServers, 16 setAccessTokensToServers,
@@ -51,7 +50,7 @@ async function checkHlsPlaylist (servers: ServerInfo[], videoUUID: string) {
51 50
52 { 51 {
53 for (const resolution of resolutions) { 52 for (const resolution of resolutions) {
54 const res2 = await getPlaylist(`http://localhost:9001/static/streaming-playlists/hls/${videoUUID}/${resolution}.m3u8`) 53 const res2 = await getPlaylist(`http://localhost:${server.port}/static/streaming-playlists/hls/${videoUUID}/${resolution}.m3u8`)
55 54
56 const subPlaylist = res2.text 55 const subPlaylist = res2.text
57 expect(subPlaylist).to.contain(`${videoUUID}-${resolution}-fragmented.mp4`) 56 expect(subPlaylist).to.contain(`${videoUUID}-${resolution}-fragmented.mp4`)
@@ -59,7 +58,7 @@ async function checkHlsPlaylist (servers: ServerInfo[], videoUUID: string) {
59 } 58 }
60 59
61 { 60 {
62 const baseUrl = 'http://localhost:9001/static/streaming-playlists/hls' 61 const baseUrl = 'http://localhost:' + server.port + '/static/streaming-playlists/hls'
63 62
64 for (const resolution of resolutions) { 63 for (const resolution of resolutions) {
65 await checkSegmentHash(baseUrl, baseUrl, videoUUID, resolution, hlsPlaylist) 64 await checkSegmentHash(baseUrl, baseUrl, videoUUID, resolution, hlsPlaylist)
diff --git a/server/tests/api/videos/video-transcoder.ts b/server/tests/api/videos/video-transcoder.ts
index 3cd43e99b..45a8c09f0 100644
--- a/server/tests/api/videos/video-transcoder.ts
+++ b/server/tests/api/videos/video-transcoder.ts
@@ -6,21 +6,21 @@ import { omit } from 'lodash'
6import { getMaxBitrate, VideoDetails, VideoResolution, VideoState } from '../../../../shared/models/videos' 6import { getMaxBitrate, VideoDetails, VideoResolution, VideoState } from '../../../../shared/models/videos'
7import { audio, getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffmpeg-utils' 7import { audio, getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffmpeg-utils'
8import { 8import {
9 buildAbsoluteFixturePath, cleanupTests, 9 buildAbsoluteFixturePath,
10 cleanupTests,
10 doubleFollow, 11 doubleFollow,
11 flushAndRunMultipleServers, 12 flushAndRunMultipleServers,
12 generateHighBitrateVideo, 13 generateHighBitrateVideo,
13 getMyVideos, 14 getMyVideos,
14 getVideo, 15 getVideo,
15 getVideosList, 16 getVideosList,
16 killallServers,
17 root, 17 root,
18 ServerInfo, 18 ServerInfo,
19 setAccessTokensToServers, 19 setAccessTokensToServers,
20 uploadVideo, 20 uploadVideo,
21 webtorrentAdd 21 webtorrentAdd
22} from '../../../../shared/extra-utils' 22} from '../../../../shared/extra-utils'
23import { extname, join } from 'path' 23import { join } from 'path'
24import { waitJobs } from '../../../../shared/extra-utils/server/jobs' 24import { waitJobs } from '../../../../shared/extra-utils/server/jobs'
25import { VIDEO_TRANSCODING_FPS } from '../../../../server/initializers/constants' 25import { VIDEO_TRANSCODING_FPS } from '../../../../server/initializers/constants'
26 26
@@ -121,7 +121,7 @@ describe('Test video transcoding', function () {
121 121
122 expect(videoDetails.files).to.have.lengthOf(4) 122 expect(videoDetails.files).to.have.lengthOf(4)
123 123
124 const path = join(root(), 'test2', 'videos', video.uuid + '-240.mp4') 124 const path = join(root(), 'test' + servers[1].internalServerNumber, 'videos', video.uuid + '-240.mp4')
125 const probe = await audio.get(path) 125 const probe = await audio.get(path)
126 126
127 if (probe.audioStream) { 127 if (probe.audioStream) {
@@ -152,7 +152,7 @@ describe('Test video transcoding', function () {
152 const videoDetails: VideoDetails = res2.body 152 const videoDetails: VideoDetails = res2.body
153 153
154 expect(videoDetails.files).to.have.lengthOf(4) 154 expect(videoDetails.files).to.have.lengthOf(4)
155 const path = join(root(), 'test2', 'videos', video.uuid + '-240.mp4') 155 const path = join(root(), 'test' + servers[1].internalServerNumber, 'videos', video.uuid + '-240.mp4')
156 const probe = await audio.get(path) 156 const probe = await audio.get(path)
157 expect(probe).to.not.have.property('audioStream') 157 expect(probe).to.not.have.property('audioStream')
158 } 158 }
@@ -179,7 +179,7 @@ describe('Test video transcoding', function () {
179 expect(videoDetails.files).to.have.lengthOf(4) 179 expect(videoDetails.files).to.have.lengthOf(4)
180 const fixturePath = buildAbsoluteFixturePath(videoAttributes.fixture) 180 const fixturePath = buildAbsoluteFixturePath(videoAttributes.fixture)
181 const fixtureVideoProbe = await audio.get(fixturePath) 181 const fixtureVideoProbe = await audio.get(fixturePath)
182 const path = join(root(), 'test2', 'videos', video.uuid + '-240.mp4') 182 const path = join(root(), 'test' + servers[1].internalServerNumber, 'videos', video.uuid + '-240.mp4')
183 const videoProbe = await audio.get(path) 183 const videoProbe = await audio.get(path)
184 if (videoProbe.audioStream && fixtureVideoProbe.audioStream) { 184 if (videoProbe.audioStream && fixtureVideoProbe.audioStream) {
185 const toOmit = [ 'max_bit_rate', 'duration', 'duration_ts', 'nb_frames', 'start_time', 'start_pts' ] 185 const toOmit = [ 'max_bit_rate', 'duration', 'duration_ts', 'nb_frames', 'start_time', 'start_pts' ]
@@ -216,13 +216,13 @@ describe('Test video transcoding', function () {
216 expect(videoDetails.files[ 3 ].fps).to.be.below(31) 216 expect(videoDetails.files[ 3 ].fps).to.be.below(31)
217 217
218 for (const resolution of [ '240', '360', '480' ]) { 218 for (const resolution of [ '240', '360', '480' ]) {
219 const path = join(root(), 'test2', 'videos', video.uuid + '-' + resolution + '.mp4') 219 const path = join(root(), 'test' + servers[1].internalServerNumber, 'videos', video.uuid + '-' + resolution + '.mp4')
220 const fps = await getVideoFileFPS(path) 220 const fps = await getVideoFileFPS(path)
221 221
222 expect(fps).to.be.below(31) 222 expect(fps).to.be.below(31)
223 } 223 }
224 224
225 const path = join(root(), 'test2', 'videos', video.uuid + '-720.mp4') 225 const path = join(root(), 'test' + servers[1].internalServerNumber, 'videos', video.uuid + '-720.mp4')
226 const fps = await getVideoFileFPS(path) 226 const fps = await getVideoFileFPS(path)
227 227
228 expect(fps).to.be.above(58).and.below(62) 228 expect(fps).to.be.above(58).and.below(62)
@@ -310,7 +310,7 @@ describe('Test video transcoding', function () {
310 const video = res.body.data.find(v => v.name === videoAttributes.name) 310 const video = res.body.data.find(v => v.name === videoAttributes.name)
311 311
312 for (const resolution of ['240', '360', '480', '720', '1080']) { 312 for (const resolution of ['240', '360', '480', '720', '1080']) {
313 const path = join(root(), 'test2', 'videos', video.uuid + '-' + resolution + '.mp4') 313 const path = join(root(), 'test' + servers[1].internalServerNumber, 'videos', video.uuid + '-' + resolution + '.mp4')
314 const bitrate = await getVideoFileBitrate(path) 314 const bitrate = await getVideoFileBitrate(path)
315 const fps = await getVideoFileFPS(path) 315 const fps = await getVideoFileFPS(path)
316 const resolution2 = await getVideoFileResolution(path) 316 const resolution2 = await getVideoFileResolution(path)
diff --git a/server/tests/cli/optimize-old-videos.ts b/server/tests/cli/optimize-old-videos.ts
index 5e12c0089..3822fca42 100644
--- a/server/tests/cli/optimize-old-videos.ts
+++ b/server/tests/cli/optimize-old-videos.ts
@@ -8,14 +8,16 @@ import {
8 doubleFollow, 8 doubleFollow,
9 execCLI, 9 execCLI,
10 flushAndRunMultipleServers, 10 flushAndRunMultipleServers,
11 flushTests, generateHighBitrateVideo, 11 generateHighBitrateVideo,
12 getEnvCli, 12 getEnvCli,
13 getVideo, 13 getVideo,
14 getVideosList, 14 getVideosList,
15 killallServers, root, 15 root,
16 ServerInfo, 16 ServerInfo,
17 setAccessTokensToServers, 17 setAccessTokensToServers,
18 uploadVideo, viewVideo, wait 18 uploadVideo,
19 viewVideo,
20 wait
19} from '../../../shared/extra-utils' 21} from '../../../shared/extra-utils'
20import { waitJobs } from '../../../shared/extra-utils/server/jobs' 22import { waitJobs } from '../../../shared/extra-utils/server/jobs'
21import { getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '../../helpers/ffmpeg-utils' 23import { getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '../../helpers/ffmpeg-utils'
@@ -102,7 +104,7 @@ describe('Test optimize old videos', function () {
102 104
103 expect(file.size).to.be.below(5000000) 105 expect(file.size).to.be.below(5000000)
104 106
105 const path = join(root(), 'test1', 'videos', video.uuid + '-' + file.resolution.id + '.mp4') 107 const path = join(root(), 'test' + servers[0].internalServerNumber, 'videos', video.uuid + '-' + file.resolution.id + '.mp4')
106 const bitrate = await getVideoFileBitrate(path) 108 const bitrate = await getVideoFileBitrate(path)
107 const fps = await getVideoFileFPS(path) 109 const fps = await getVideoFileFPS(path)
108 const resolution = await getVideoFileResolution(path) 110 const resolution = await getVideoFileResolution(path)