]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix public video we set to public or unlisted
authorChocobozzz <florian.bigard@gmail.com>
Fri, 17 Nov 2017 14:42:12 +0000 (15:42 +0100)
committerChocobozzz <florian.bigard@gmail.com>
Mon, 27 Nov 2017 18:40:52 +0000 (19:40 +0100)
13 files changed:
server/controllers/api/videos/index.ts
server/tests/api/multiple-servers.ts
server/tests/api/services.ts
server/tests/api/single-server.ts
server/tests/api/users.ts
server/tests/api/video-abuse.ts
server/tests/api/video-blacklist-management.ts
server/tests/api/video-blacklist.ts
server/tests/api/video-channels.ts
server/tests/api/video-description.ts
server/tests/api/video-privacy.ts
server/tests/api/video-transcoder.ts
server/tests/utils/follows.ts

index a5414cc50aa145b6d3cae0aafd2e2d3cd23962d3..22a88620a8ac12fa75cb8d14ac8fefa07c8b7306 100644 (file)
@@ -291,6 +291,7 @@ async function updateVideo (req: express.Request, res: express.Response) {
       // Video is not private anymore, send a create action to remote servers
       if (wasPrivateVideo === true && videoInstance.privacy !== VideoPrivacy.PRIVATE) {
         await sendAddVideo(videoInstance, t)
+        await shareVideoByServer(videoInstance, t)
       }
     })
 
index 737770992d6f25539687d9b6444096e4342b47d5..b6a57ab6d46269979ffd42db24ef3534476ea616 100644 (file)
@@ -85,7 +85,7 @@ describe('Test multiple servers', function () {
       }
       await uploadVideo(servers[0].url, servers[0].accessToken, videoAttributes)
 
-      await wait(11000)
+      await wait(5000)
 
       // All servers should have this video
       for (const server of servers) {
@@ -153,7 +153,7 @@ describe('Test multiple servers', function () {
     })
 
     it('Should upload the video on server 2 and propagate on each server', async function () {
-      this.timeout(120000)
+      this.timeout(50000)
 
       const user = {
         username: 'user1',
@@ -174,8 +174,8 @@ describe('Test multiple servers', function () {
       }
       await uploadVideo(servers[1].url, userAccessToken, videoAttributes)
 
-      // Transcoding, so wait more than 22000
-      await wait(60000)
+      // Transcoding
+      await wait(10000)
 
       // All servers should have this video
       for (const server of servers) {
@@ -282,7 +282,7 @@ describe('Test multiple servers', function () {
       }
       await uploadVideo(servers[2].url, servers[2].accessToken, videoAttributes2)
 
-      await wait(33000)
+      await wait(10000)
 
       let baseMagnet = null
       // All servers should have this video
@@ -384,8 +384,7 @@ describe('Test multiple servers', function () {
 
   describe('Should seed the uploaded video', function () {
     it('Should add the file 1 by asking server 3', async function () {
-      // Yes, this could be long
-      this.timeout(200000)
+      this.timeout(10000)
 
       const res = await getVideosList(servers[2].url)
 
@@ -403,8 +402,7 @@ describe('Test multiple servers', function () {
     })
 
     it('Should add the file 2 by asking server 1', async function () {
-      // Yes, this could be long
-      this.timeout(200000)
+      this.timeout(10000)
 
       const res = await getVideosList(servers[0].url)
 
@@ -419,8 +417,7 @@ describe('Test multiple servers', function () {
     })
 
     it('Should add the file 3 by asking server 2', async function () {
-      // Yes, this could be long
-      this.timeout(200000)
+      this.timeout(10000)
 
       const res = await getVideosList(servers[1].url)
 
@@ -435,8 +432,7 @@ describe('Test multiple servers', function () {
     })
 
     it('Should add the file 3-2 by asking server 1', async function () {
-      // Yes, this could be long
-      this.timeout(200000)
+      this.timeout(10000)
 
       const res = await getVideosList(servers[0].url)
 
@@ -451,8 +447,7 @@ describe('Test multiple servers', function () {
     })
 
     it('Should add the file 2 in 360p by asking server 1', async function () {
-      // Yes, this could be long
-      this.timeout(200000)
+      this.timeout(10000)
 
       const res = await getVideosList(servers[0].url)
 
@@ -489,7 +484,7 @@ describe('Test multiple servers', function () {
     })
 
     it('Should view multiple videos on owned servers', async function () {
-      this.timeout(30000)
+      this.timeout(10000)
 
       const tasks: Promise<any>[] = []
       tasks.push(getVideo(servers[2].url, localVideosServer3[0]))
@@ -499,7 +494,7 @@ describe('Test multiple servers', function () {
 
       await Promise.all(tasks)
 
-      await wait(22000)
+      await wait(5000)
 
       for (const server of servers) {
         const res = await getVideosList(server.url)
@@ -514,7 +509,7 @@ describe('Test multiple servers', function () {
     })
 
     it('Should view multiple videos on each servers', async function () {
-      this.timeout(30000)
+      this.timeout(15000)
 
       const tasks: Promise<any>[] = []
       tasks.push(getVideo(servers[0].url, remoteVideosServer1[0]))
@@ -530,7 +525,7 @@ describe('Test multiple servers', function () {
 
       await Promise.all(tasks)
 
-      await wait(22000)
+      await wait(10000)
 
       let baseVideos = null
 
@@ -553,7 +548,7 @@ describe('Test multiple servers', function () {
     })
 
     it('Should like and dislikes videos on different services', async function () {
-      this.timeout(30000)
+      this.timeout(20000)
 
       const tasks: Promise<any>[] = []
       tasks.push(rateVideo(servers[0].url, servers[0].accessToken, remoteVideosServer1[0], 'like'))
@@ -566,7 +561,7 @@ describe('Test multiple servers', function () {
 
       await Promise.all(tasks)
 
-      await wait(22000)
+      await wait(10000)
 
       let baseVideos = null
       for (const server of servers) {
@@ -591,7 +586,7 @@ describe('Test multiple servers', function () {
 
   describe('Should manipulate these videos', function () {
     it('Should update the video 3 by asking server 3', async function () {
-      this.timeout(15000)
+      this.timeout(10000)
 
       const attributes = {
         name: 'my super video updated',
@@ -605,11 +600,11 @@ describe('Test multiple servers', function () {
 
       await updateVideo(servers[2].url, servers[2].accessToken, toRemove[0].id, attributes)
 
-      await wait(11000)
+      await wait(5000)
     })
 
     it('Should have the video 3 updated on each server', async function () {
-      this.timeout(200000)
+      this.timeout(10000)
 
       for (const server of servers) {
         const res = await getVideosList(server.url)
@@ -651,12 +646,12 @@ describe('Test multiple servers', function () {
     })
 
     it('Should remove the videos 3 and 3-2 by asking server 3', async function () {
-      this.timeout(15000)
+      this.timeout(10000)
 
       await removeVideo(servers[2].url, servers[2].accessToken, toRemove[0].id)
       await removeVideo(servers[2].url, servers[2].accessToken, toRemove[1].id)
 
-      await wait(11000)
+      await wait(5000)
     })
 
     it('Should have videos 1 and 3 on each server', async function () {
index 3e6506de4fa13cb4a284fb2137228079f9f9db55..8d96ccc5ee0123a198439d3866eefbd8bd7dc44e 100644 (file)
@@ -19,7 +19,7 @@ describe('Test services', function () {
   let server: ServerInfo = null
 
   before(async function () {
-    this.timeout(120000)
+    this.timeout(10000)
 
     await flushTests()
 
index 82ecc68eec5a01ebe97f88fe4452b8b84b87b6eb..11080085d9a321522c91adc1c31c07f84acdbf83 100644 (file)
@@ -41,7 +41,7 @@ describe('Test a single server', function () {
   let videosListBase: any[] = null
 
   before(async function () {
-    this.timeout(120000)
+    this.timeout(10000)
 
     await flushTests()
 
index 055dade04e0abb481d1f08ffe485b30c075670fa..5c053157114bdc110f075f304086780fcf8ba93f 100644 (file)
@@ -39,7 +39,7 @@ describe('Test users', function () {
   let userId: number
 
   before(async function () {
-    this.timeout(120000)
+    this.timeout(10000)
 
     await flushTests()
     server = await runServer(1)
index bc21ee59b7e779f24bc95fa719f689ea321eb8aa..60bee9c3d40d51d8b3443a658da86fe26c94c6b5 100644 (file)
@@ -22,7 +22,7 @@ describe('Test video abuses', function () {
   let servers: ServerInfo[] = []
 
   before(async function () {
-    this.timeout(100000)
+    this.timeout(50000)
 
     // Run servers
     servers = await flushAndRunMultipleServers(2)
@@ -46,8 +46,8 @@ describe('Test video abuses', function () {
     }
     await uploadVideo(servers[1].url, servers[1].accessToken, video2Attributes)
 
-    // Wait videos propagation
-    await wait(25000)
+    // Wait videos propagation, server 2 has transcoding enabled
+    await wait(10000)
 
     const res = await getVideosList(servers[0].url)
     const videos = res.body.data
@@ -67,13 +67,13 @@ describe('Test video abuses', function () {
   })
 
   it('Should report abuse on a local video', async function () {
-    this.timeout(15000)
+    this.timeout(10000)
 
     const reason = 'my super bad reason'
     await reportVideoAbuse(servers[0].url, servers[0].accessToken, servers[0].video.id, reason)
 
     // We wait requests propagation, even if the server 1 is not supposed to make a request to server 2
-    await wait(11000)
+    await wait(5000)
   })
 
   it('Should have 1 video abuses on server 1 and 0 on server 2', async function () {
@@ -96,13 +96,13 @@ describe('Test video abuses', function () {
   })
 
   it('Should report abuse on a remote video', async function () {
-    this.timeout(25000)
+    this.timeout(10000)
 
     const reason = 'my super bad reason 2'
     await reportVideoAbuse(servers[0].url, servers[0].accessToken, servers[1].video.id, reason)
 
     // We wait requests propagation
-    await wait(15000)
+    await wait(5000)
   })
 
   it('Should have 2 video abuse on server 1 and 1 on server 2', async function () {
index 71878931871665b8d71ca806004de5b11cee35dd..0c636e094e3beadd2139eeeca10a0b6a0feeee40 100644 (file)
@@ -35,7 +35,7 @@ describe('Test video blacklist management', function () {
   }
 
   before(async function () {
-    this.timeout(120000)
+    this.timeout(50000)
 
     // Run servers
     servers = await flushAndRunMultipleServers(2)
@@ -50,8 +50,8 @@ describe('Test video blacklist management', function () {
     await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'My 1st video', description: 'A video on server 2' })
     await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'My 2nd video', description: 'A video on server 2' })
 
-    // Wait videos propagation
-    await wait(50000)
+    // Wait videos propagation, server 2 has transcoding enabled
+    await wait(15000)
 
     // Blacklist the two videos on server 1
     await blacklistVideosOnServer(servers[0])
index 235fdd7af9e19c9641522a9874385f454cdf8953..3afd8c5103a61e2b6f9946f8facbb3780628cda1 100644 (file)
@@ -22,7 +22,7 @@ describe('Test video blacklists', function () {
   let servers: ServerInfo[] = []
 
   before(async function () {
-    this.timeout(120000)
+    this.timeout(50000)
 
     // Run servers
     servers = await flushAndRunMultipleServers(2)
@@ -40,8 +40,8 @@ describe('Test video blacklists', function () {
     }
     await uploadVideo(servers[1].url, servers[1].accessToken, videoAttributes)
 
-    // Wait videos propagation
-    await wait(25000)
+    // Wait videos propagation, server 2 has transcoding enabled
+    await wait(10000)
 
     const res = await getVideosList(servers[0].url)
     const videos = res.body.data
index de1807ef2b58893f9340b9e8328411271ecc1b8b..2d8efb3202ba49d3c2804507384f0583cb619918 100644 (file)
@@ -26,7 +26,7 @@ describe('Test a video channels', function () {
   let videoChannelId: number
 
   before(async function () {
-    this.timeout(120000)
+    this.timeout(10000)
 
     await flushTests()
 
index 187fd21f2344a131285bf12111916f0b373e40aa..7ad1c63ae85a2daf1e803032e7b9567b8c3f64ce 100644 (file)
@@ -26,7 +26,7 @@ describe('Test video description', function () {
   let longDescription = 'my super description for server 1'.repeat(50)
 
   before(async function () {
-    this.timeout(30000)
+    this.timeout(40000)
 
     // Run servers
     servers = await flushAndRunMultipleServers(2)
@@ -39,14 +39,14 @@ describe('Test video description', function () {
   })
 
   it('Should upload video with long description', async function () {
-    this.timeout(30000)
+    this.timeout(10000)
 
     const attributes = {
       description: longDescription
     }
     await uploadVideo(servers[0].url, servers[0].accessToken, attributes)
 
-    await wait(25000)
+    await wait(5000)
 
     const res = await getVideosList(servers[0].url)
 
@@ -78,14 +78,14 @@ describe('Test video description', function () {
   })
 
   it('Should update with a short description', async function () {
-    this.timeout(30000)
+    this.timeout(10000)
 
     const attributes = {
       description: 'short description'
     }
     await updateVideo(servers[0].url, servers[0].accessToken, videoId, attributes)
 
-    await wait(25000)
+    await wait(5000)
   })
 
   it('Should have a small description on each server', async function () {
index bf91ead2e91c38cfcda6715b5ae902da9102d117..26847efce537ca6f8eec45b595a63b7a43f8fd43 100644 (file)
@@ -27,7 +27,7 @@ describe('Test video privacy', function () {
   let unlistedVideoUUID
 
   before(async function () {
-    this.timeout(120000)
+    this.timeout(50000)
 
     // Run servers
     servers = await flushAndRunMultipleServers(2)
@@ -40,14 +40,14 @@ describe('Test video privacy', function () {
   })
 
   it('Should upload a private video on server 1', async function () {
-    this.timeout(25000)
+    this.timeout(10000)
 
     const attributes = {
       privacy: VideoPrivacy.PRIVATE
     }
     await uploadVideo(servers[0].url, servers[0].accessToken, attributes)
 
-    await wait(15000)
+    await wait(5000)
   })
 
   it('Should not have this private video on server 2', async function () {
@@ -87,7 +87,7 @@ describe('Test video privacy', function () {
   })
 
   it('Should upload an unlisted video on server 2', async function () {
-    this.timeout(50000)
+    this.timeout(30000)
 
     const attributes = {
       name: 'unlisted video',
@@ -95,7 +95,8 @@ describe('Test video privacy', function () {
     }
     await uploadVideo(servers[1].url, servers[1].accessToken, attributes)
 
-    await wait(40000)
+    // Server 2 has transcoding enabled
+    await wait(10000)
   })
 
   it('Should not have this unlisted video listed on server 1 and 2', async function () {
@@ -125,7 +126,7 @@ describe('Test video privacy', function () {
   })
 
   it('Should update the private video to public on server 1', async function () {
-    this.timeout(40000)
+    this.timeout(10000)
 
     const attribute = {
       name: 'super video public',
@@ -134,7 +135,7 @@ describe('Test video privacy', function () {
 
     await updateVideo(servers[0].url, servers[0].accessToken, privateVideoId, attribute)
 
-    await wait(30000)
+    await wait(5000)
   })
 
   it('Should have this new public video listed on server 1 and 2', async function () {
index e80b099d10b36b75b146baca78387b107d6b0b4c..95d48342fd02514335820c95e271efff21661c1a 100644 (file)
@@ -21,7 +21,7 @@ describe('Test video transcoding', function () {
   let servers: ServerInfo[] = []
 
   before(async function () {
-    this.timeout(60000)
+    this.timeout(10000)
 
     // Run servers
     servers = await flushAndRunMultipleServers(2)
@@ -39,7 +39,7 @@ describe('Test video transcoding', function () {
     }
     await uploadVideo(servers[0].url, servers[0].accessToken, videoAttributes)
 
-    await wait(30000)
+    await wait(10000)
 
     const res = await getVideosList(servers[0].url)
     const video = res.body.data[0]
@@ -67,7 +67,7 @@ describe('Test video transcoding', function () {
     }
     await uploadVideo(servers[1].url, servers[1].accessToken, videoAttributes)
 
-    await wait(30000)
+    await wait(10000)
 
     const res = await getVideosList(servers[1].url)
 
index cffc1648fac0ccd4a8a48eee2a67a12e32ca5bec..618436b3cfb1ad1563a0ffd680723dc3cf640b99 100644 (file)
@@ -39,9 +39,6 @@ async function follow (follower: string, following: string[], accessToken: strin
     .send({ 'hosts': followingHosts })
     .expect(expectedStatus)
 
-  // Wait request propagation
-  await wait(20000)
-
   return res
 }
 
@@ -51,6 +48,9 @@ async function doubleFollow (server1: ServerInfo, server2: ServerInfo) {
     follow(server2.url, [ server1.url ], server2.accessToken)
   ])
 
+  // Wait request propagation
+  await wait(20000)
+
   return true
 }