X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fmultiple-servers.ts;h=c7f19f26160199edae8618b68db607e8bea21715;hb=b1fa3eba70dbd7d9e5b795ad251e293c88ebeee2;hp=601e5f39a10b80e9613f68bc8dd401a1a375ec82;hpb=d8553faa4939889fa7b7ef7329aa474a81cbbdb9;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/multiple-servers.ts b/server/tests/api/multiple-servers.ts index 601e5f39a..c7f19f261 100644 --- a/server/tests/api/multiple-servers.ts +++ b/server/tests/api/multiple-servers.ts @@ -25,6 +25,7 @@ import { doubleFollow } from '../utils' import { createUser } from '../utils/users' +import { viewVideo } from '../utils/videos' const expect = chai.expect @@ -69,8 +70,7 @@ describe('Test multiple servers', function () { describe('Should upload the video and propagate on each server', function () { it('Should upload the video on server 1 and propagate on each server', async function () { - // Server 1 has video transcoding activated - this.timeout(15000) + this.timeout(25000) const videoAttributes = { name: 'my super name for server 1', @@ -85,7 +85,7 @@ describe('Test multiple servers', function () { } await uploadVideo(servers[0].url, servers[0].accessToken, videoAttributes) - await wait(5000) + await wait(10000) // All servers should have this video for (const server of servers) { @@ -111,13 +111,14 @@ describe('Test multiple servers', function () { expect(video.tags).to.deep.equal([ 'tag1p1', 'tag2p1' ]) expect(dateIsValid(video.createdAt)).to.be.true expect(dateIsValid(video.updatedAt)).to.be.true - expect(video.account).to.equal('root') + expect(video.accountName).to.equal('root') const res2 = await getVideo(server.url, video.uuid) const videoDetails = res2.body expect(videoDetails.channel.name).to.equal('my channel') expect(videoDetails.channel.description).to.equal('super channel') + expect(videoDetails.account.name).to.equal('root') expect(dateIsValid(videoDetails.channel.createdAt)).to.be.true expect(dateIsValid(videoDetails.channel.updatedAt)).to.be.true expect(videoDetails.files).to.have.lengthOf(1) @@ -175,7 +176,7 @@ describe('Test multiple servers', function () { await uploadVideo(servers[1].url, userAccessToken, videoAttributes) // Transcoding - await wait(25000) + await wait(30000) // All servers should have this video for (const server of servers) { @@ -201,7 +202,7 @@ describe('Test multiple servers', function () { expect(video.tags).to.deep.equal([ 'tag1p2', 'tag2p2', 'tag3p2' ]) expect(dateIsValid(video.createdAt)).to.be.true expect(dateIsValid(video.updatedAt)).to.be.true - expect(video.account).to.equal('user1') + expect(video.accountName).to.equal('user1') if (server.url !== 'http://localhost:9002') { expect(video.isLocal).to.be.false @@ -316,7 +317,7 @@ describe('Test multiple servers', function () { expect(video1.serverHost).to.equal('localhost:9003') expect(video1.duration).to.equal(5) expect(video1.tags).to.deep.equal([ 'tag1p3' ]) - expect(video1.account).to.equal('root') + expect(video1.accountName).to.equal('root') expect(dateIsValid(video1.createdAt)).to.be.true expect(dateIsValid(video1.updatedAt)).to.be.true @@ -342,7 +343,7 @@ describe('Test multiple servers', function () { expect(video2.serverHost).to.equal('localhost:9003') expect(video2.duration).to.equal(5) expect(video2.tags).to.deep.equal([ 'tag2p3', 'tag3p3', 'tag4p3' ]) - expect(video2.account).to.equal('root') + expect(video2.accountName).to.equal('root') expect(dateIsValid(video2.createdAt)).to.be.true expect(dateIsValid(video2.updatedAt)).to.be.true @@ -487,10 +488,10 @@ describe('Test multiple servers', function () { this.timeout(10000) const tasks: Promise[] = [] - tasks.push(getVideo(servers[2].url, localVideosServer3[0])) - tasks.push(getVideo(servers[2].url, localVideosServer3[0])) - tasks.push(getVideo(servers[2].url, localVideosServer3[0])) - tasks.push(getVideo(servers[2].url, localVideosServer3[1])) + tasks.push(viewVideo(servers[2].url, localVideosServer3[0])) + tasks.push(viewVideo(servers[2].url, localVideosServer3[0])) + tasks.push(viewVideo(servers[2].url, localVideosServer3[0])) + tasks.push(viewVideo(servers[2].url, localVideosServer3[1])) await Promise.all(tasks) @@ -503,8 +504,8 @@ describe('Test multiple servers', function () { const video0 = videos.find(v => v.uuid === localVideosServer3[0]) const video1 = videos.find(v => v.uuid === localVideosServer3[1]) - expect(video0.views).to.equal(7) - expect(video1.views).to.equal(5) + expect(video0.views).to.equal(3) + expect(video1.views).to.equal(1) } }) @@ -512,16 +513,16 @@ describe('Test multiple servers', function () { this.timeout(15000) const tasks: Promise[] = [] - tasks.push(getVideo(servers[0].url, remoteVideosServer1[0])) - tasks.push(getVideo(servers[1].url, remoteVideosServer2[0])) - tasks.push(getVideo(servers[1].url, remoteVideosServer2[0])) - tasks.push(getVideo(servers[2].url, remoteVideosServer3[0])) - tasks.push(getVideo(servers[2].url, remoteVideosServer3[1])) - tasks.push(getVideo(servers[2].url, remoteVideosServer3[1])) - tasks.push(getVideo(servers[2].url, remoteVideosServer3[1])) - tasks.push(getVideo(servers[2].url, localVideosServer3[1])) - tasks.push(getVideo(servers[2].url, localVideosServer3[1])) - tasks.push(getVideo(servers[2].url, localVideosServer3[1])) + tasks.push(viewVideo(servers[0].url, remoteVideosServer1[0])) + tasks.push(viewVideo(servers[1].url, remoteVideosServer2[0])) + tasks.push(viewVideo(servers[1].url, remoteVideosServer2[0])) + tasks.push(viewVideo(servers[2].url, remoteVideosServer3[0])) + tasks.push(viewVideo(servers[2].url, remoteVideosServer3[1])) + tasks.push(viewVideo(servers[2].url, remoteVideosServer3[1])) + tasks.push(viewVideo(servers[2].url, remoteVideosServer3[1])) + tasks.push(viewVideo(servers[2].url, localVideosServer3[1])) + tasks.push(viewVideo(servers[2].url, localVideosServer3[1])) + tasks.push(viewVideo(servers[2].url, localVideosServer3[1])) await Promise.all(tasks) @@ -690,7 +691,7 @@ describe('Test multiple servers', function () { expect(baseVideo.licence).to.equal(video.licence) expect(baseVideo.category).to.equal(video.category) expect(baseVideo.nsfw).to.equal(video.nsfw) - expect(baseVideo.account).to.equal(video.account) + expect(baseVideo.accountName).to.equal(video.accountName) expect(baseVideo.tags).to.deep.equal(video.tags) } })