aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/cli
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/cli')
-rw-r--r--server/tests/cli/update-host.ts30
1 files changed, 19 insertions, 11 deletions
diff --git a/server/tests/cli/update-host.ts b/server/tests/cli/update-host.ts
index 644b3807e..e31a84156 100644
--- a/server/tests/cli/update-host.ts
+++ b/server/tests/cli/update-host.ts
@@ -12,14 +12,15 @@ import {
12 runServer, 12 runServer,
13 ServerInfo, 13 ServerInfo,
14 setAccessTokensToServers, 14 setAccessTokensToServers,
15 uploadVideo 15 uploadVideo,
16 wait
16} from '../utils' 17} from '../utils'
17 18
18describe('Test update host scripts', function () { 19describe('Test update host scripts', function () {
19 let server: ServerInfo 20 let server: ServerInfo
20 21
21 before(async function () { 22 before(async function () {
22 this.timeout(30000) 23 this.timeout(60000)
23 24
24 await flushTests() 25 await flushTests()
25 26
@@ -28,36 +29,43 @@ describe('Test update host scripts', function () {
28 port: 9256 29 port: 9256
29 } 30 }
30 } 31 }
31 server = await runServer(1, overrideConfig) 32 // Run server 2 to have transcoding enabled
33 server = await runServer(2, overrideConfig)
32 await setAccessTokensToServers([ server ]) 34 await setAccessTokensToServers([ server ])
33 35
34 // Upload two videos for our needs 36 // Upload two videos for our needs
35 const videoAttributes = {} 37 const videoAttributes = {}
36 await uploadVideo(server.url, server.accessToken, videoAttributes) 38 await uploadVideo(server.url, server.accessToken, videoAttributes)
37 await uploadVideo(server.url, server.accessToken, videoAttributes) 39 await uploadVideo(server.url, server.accessToken, videoAttributes)
40 await wait(30000)
38 }) 41 })
39 42
40 it('Should update torrent hosts', async function () { 43 it('Should update torrent hosts', async function () {
41 this.timeout(30000) 44 this.timeout(30000)
42 45
43 killallServers([ server ]) 46 killallServers([ server ])
44 server = await runServer(1) 47 // Run server with standard configuration
48 server = await runServer(2)
45 49
46 const env = getEnvCli(server) 50 const env = getEnvCli(server)
47 await execCLI(`${env} npm run update-host`) 51 await execCLI(`${env} npm run update-host`)
48 52
49 const res = await getVideosList(server.url) 53 const res = await getVideosList(server.url)
50 const videos = res.body.data 54 const videos = res.body.data
55 expect(videos).to.have.lengthOf(2)
51 56
52 expect(videos[0].files[0].magnetUri).to.contain('localhost%3A9001%2Ftracker%2Fsocket') 57 for (const video of videos) {
53 expect(videos[0].files[0].magnetUri).to.contain('localhost%3A9001%2Fstatic%2Fwebseed%2F') 58 expect(video.files).to.have.lengthOf(5)
54 59
55 expect(videos[1].files[0].magnetUri).to.contain('localhost%3A9001%2Ftracker%2Fsocket') 60 for (const file of video.files) {
56 expect(videos[1].files[0].magnetUri).to.contain('localhost%3A9001%2Fstatic%2Fwebseed%2F') 61 expect(file.magnetUri).to.contain('localhost%3A9002%2Ftracker%2Fsocket')
62 expect(file.magnetUri).to.contain('localhost%3A9002%2Fstatic%2Fwebseed%2F')
57 63
58 const torrent = await parseTorrentVideo(server, videos[0].uuid) 64 const torrent = await parseTorrentVideo(server, video.uuid, file.resolutionLabel)
59 expect(torrent.announce[0]).to.equal('ws://localhost:9001/tracker/socket') 65 expect(torrent.announce[0]).to.equal('ws://localhost:9002/tracker/socket')
60 expect(torrent.urlList[0]).to.contain('http://localhost:9001/static/webseed') 66 expect(torrent.urlList[0]).to.contain('http://localhost:9002/static/webseed')
67 }
68 }
61 }) 69 })
62 70
63 after(async function () { 71 after(async function () {