diff options
Diffstat (limited to 'server/tests/api/videos')
-rw-r--r-- | server/tests/api/videos/multiple-servers.ts | 41 | ||||
-rw-r--r-- | server/tests/api/videos/services.ts | 10 | ||||
-rw-r--r-- | server/tests/api/videos/single-server.ts | 4 | ||||
-rw-r--r-- | server/tests/api/videos/video-abuse.ts | 9 | ||||
-rw-r--r-- | server/tests/api/videos/video-channels.ts | 6 | ||||
-rw-r--r-- | server/tests/api/videos/video-comments.ts | 6 | ||||
-rw-r--r-- | server/tests/api/videos/video-hls.ts | 9 | ||||
-rw-r--r-- | server/tests/api/videos/video-transcoder.ts | 18 |
8 files changed, 50 insertions, 53 deletions
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/ | |||
9 | import { | 9 | import { |
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' | |||
5 | import { | 5 | import { |
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' | |||
6 | import { getMaxBitrate, VideoDetails, VideoResolution, VideoState } from '../../../../shared/models/videos' | 6 | import { getMaxBitrate, VideoDetails, VideoResolution, VideoState } from '../../../../shared/models/videos' |
7 | import { audio, getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffmpeg-utils' | 7 | import { audio, getVideoFileBitrate, getVideoFileFPS, getVideoFileResolution } from '../../../helpers/ffmpeg-utils' |
8 | import { | 8 | import { |
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' |
23 | import { extname, join } from 'path' | 23 | import { join } from 'path' |
24 | import { waitJobs } from '../../../../shared/extra-utils/server/jobs' | 24 | import { waitJobs } from '../../../../shared/extra-utils/server/jobs' |
25 | import { VIDEO_TRANSCODING_FPS } from '../../../../server/initializers/constants' | 25 | import { 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) |