aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-11-06 16:43:43 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-11-09 15:33:04 +0100
commitc655c9ef6f7ddb47a153adc04d5c10c6de3d5ed7 (patch)
tree7ccb6a7c97345747dde6c53fcd10c488140c7998 /server
parente4bf78561763cd84d22ebceb6f371cccf9a356d8 (diff)
downloadPeerTube-c655c9ef6f7ddb47a153adc04d5c10c6de3d5ed7.tar.gz
PeerTube-c655c9ef6f7ddb47a153adc04d5c10c6de3d5ed7.tar.zst
PeerTube-c655c9ef6f7ddb47a153adc04d5c10c6de3d5ed7.zip
Update ffmpeg static version for tests
Diffstat (limited to 'server')
-rw-r--r--server/initializers/constants.ts2
-rw-r--r--server/lib/activitypub/process/process-view.ts6
-rw-r--r--server/lib/live-manager.ts3
-rw-r--r--server/tests/api/live/live.ts6
-rw-r--r--server/tests/api/server/config.ts6
-rw-r--r--server/tests/api/videos/videos-views-cleaner.ts4
-rw-r--r--server/tests/plugins/plugin-helpers.ts2
7 files changed, 16 insertions, 13 deletions
diff --git a/server/initializers/constants.ts b/server/initializers/constants.ts
index a93fe3c51..2e45ab256 100644
--- a/server/initializers/constants.ts
+++ b/server/initializers/constants.ts
@@ -316,7 +316,7 @@ const CONSTRAINTS_FIELDS = {
316 } 316 }
317} 317}
318 318
319let VIEW_LIFETIME = { 319const VIEW_LIFETIME = {
320 VIDEO: 60000 * 60, // 1 hour 320 VIDEO: 60000 * 60, // 1 hour
321 LIVE: 60000 * 5 // 5 minutes 321 LIVE: 60000 * 5 // 5 minutes
322} 322}
diff --git a/server/lib/activitypub/process/process-view.ts b/server/lib/activitypub/process/process-view.ts
index efceb21a2..84697673b 100644
--- a/server/lib/activitypub/process/process-view.ts
+++ b/server/lib/activitypub/process/process-view.ts
@@ -31,6 +31,10 @@ async function processCreateView (activity: ActivityView | ActivityCreate, byAct
31 } 31 }
32 const { video } = await getOrCreateVideoAndAccountAndChannel(options) 32 const { video } = await getOrCreateVideoAndAccountAndChannel(options)
33 33
34 if (!video.isLive) {
35 await Redis.Instance.addVideoView(video.id)
36 }
37
34 if (video.isOwned()) { 38 if (video.isOwned()) {
35 // Our live manager will increment the counter and send the view to followers 39 // Our live manager will increment the counter and send the view to followers
36 if (video.isLive) { 40 if (video.isLive) {
@@ -38,8 +42,6 @@ async function processCreateView (activity: ActivityView | ActivityCreate, byAct
38 return 42 return
39 } 43 }
40 44
41 await Redis.Instance.addVideoView(video.id)
42
43 // Forward the view but don't resend the activity to the sender 45 // Forward the view but don't resend the activity to the sender
44 const exceptions = [ byActor ] 46 const exceptions = [ byActor ]
45 await forwardVideoRelatedActivity(activity, undefined, exceptions, video) 47 await forwardVideoRelatedActivity(activity, undefined, exceptions, video)
diff --git a/server/lib/live-manager.ts b/server/lib/live-manager.ts
index 4a1081a4f..e85998686 100644
--- a/server/lib/live-manager.ts
+++ b/server/lib/live-manager.ts
@@ -4,6 +4,7 @@ import * as chokidar from 'chokidar'
4import { FfmpegCommand } from 'fluent-ffmpeg' 4import { FfmpegCommand } from 'fluent-ffmpeg'
5import { ensureDir, stat } from 'fs-extra' 5import { ensureDir, stat } from 'fs-extra'
6import { basename } from 'path' 6import { basename } from 'path'
7import { isTestInstance } from '@server/helpers/core-utils'
7import { 8import {
8 computeResolutionsToTranscode, 9 computeResolutionsToTranscode,
9 getVideoFileFPS, 10 getVideoFileFPS,
@@ -451,7 +452,7 @@ class LiveManager {
451 private async updateLiveViews () { 452 private async updateLiveViews () {
452 if (!this.isRunning()) return 453 if (!this.isRunning()) return
453 454
454 logger.info('Updating live video views.') 455 if (!isTestInstance()) logger.info('Updating live video views.')
455 456
456 for (const videoId of this.watchersPerVideo.keys()) { 457 for (const videoId of this.watchersPerVideo.keys()) {
457 const notBefore = new Date().getTime() - VIEW_LIFETIME.LIVE 458 const notBefore = new Date().getTime() - VIEW_LIFETIME.LIVE
diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts
index 2198114b4..de3181928 100644
--- a/server/tests/api/live/live.ts
+++ b/server/tests/api/live/live.ts
@@ -121,7 +121,7 @@ describe('Test live', function () {
121 const live: LiveVideo = resLive.body 121 const live: LiveVideo = resLive.body
122 122
123 if (server.url === servers[0].url) { 123 if (server.url === servers[0].url) {
124 expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':1936/live') 124 expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + servers[0].rtmpPort + '/live')
125 expect(live.streamKey).to.not.be.empty 125 expect(live.streamKey).to.not.be.empty
126 } else { 126 } else {
127 expect(live.rtmpUrl).to.be.null 127 expect(live.rtmpUrl).to.be.null
@@ -185,7 +185,7 @@ describe('Test live', function () {
185 const live: LiveVideo = res.body 185 const live: LiveVideo = res.body
186 186
187 if (server.url === servers[0].url) { 187 if (server.url === servers[0].url) {
188 expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':1936/live') 188 expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + servers[0].rtmpPort + '/live')
189 expect(live.streamKey).to.not.be.empty 189 expect(live.streamKey).to.not.be.empty
190 } else { 190 } else {
191 expect(live.rtmpUrl).to.be.null 191 expect(live.rtmpUrl).to.be.null
@@ -216,7 +216,7 @@ describe('Test live', function () {
216 let rtmpUrl: string 216 let rtmpUrl: string
217 217
218 before(function () { 218 before(function () {
219 rtmpUrl = 'rtmp://' + servers[0].hostname + ':1936' 219 rtmpUrl = 'rtmp://' + servers[0].hostname + ':' + servers[0].rtmpPort + ''
220 }) 220 })
221 221
222 async function createLiveWrapper () { 222 async function createLiveWrapper () {
diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts
index 6c37be113..c4dcfd96c 100644
--- a/server/tests/api/server/config.ts
+++ b/server/tests/api/server/config.ts
@@ -79,7 +79,7 @@ function checkInitialConfig (server: ServerInfo, data: CustomConfig) {
79 expect(data.transcoding.hls.enabled).to.be.true 79 expect(data.transcoding.hls.enabled).to.be.true
80 80
81 expect(data.live.enabled).to.be.false 81 expect(data.live.enabled).to.be.false
82 expect(data.live.allowReplay).to.be.true 82 expect(data.live.allowReplay).to.be.false
83 expect(data.live.maxDuration).to.equal(1000 * 3600 * 5) 83 expect(data.live.maxDuration).to.equal(1000 * 3600 * 5)
84 expect(data.live.maxInstanceLives).to.equal(20) 84 expect(data.live.maxInstanceLives).to.equal(20)
85 expect(data.live.maxUserLives).to.equal(3) 85 expect(data.live.maxUserLives).to.equal(3)
@@ -166,7 +166,7 @@ function checkUpdatedConfig (data: CustomConfig) {
166 expect(data.transcoding.webtorrent.enabled).to.be.true 166 expect(data.transcoding.webtorrent.enabled).to.be.true
167 167
168 expect(data.live.enabled).to.be.true 168 expect(data.live.enabled).to.be.true
169 expect(data.live.allowReplay).to.be.false 169 expect(data.live.allowReplay).to.be.true
170 expect(data.live.maxDuration).to.equal(5000) 170 expect(data.live.maxDuration).to.equal(5000)
171 expect(data.live.maxInstanceLives).to.equal(-1) 171 expect(data.live.maxInstanceLives).to.equal(-1)
172 expect(data.live.maxUserLives).to.equal(10) 172 expect(data.live.maxUserLives).to.equal(10)
@@ -332,7 +332,7 @@ describe('Test config', function () {
332 }, 332 },
333 live: { 333 live: {
334 enabled: true, 334 enabled: true,
335 allowReplay: false, 335 allowReplay: true,
336 maxDuration: 5000, 336 maxDuration: 5000,
337 maxInstanceLives: -1, 337 maxInstanceLives: -1,
338 maxUserLives: 10, 338 maxUserLives: 10,
diff --git a/server/tests/api/videos/videos-views-cleaner.ts b/server/tests/api/videos/videos-views-cleaner.ts
index d063d7973..c5b28540c 100644
--- a/server/tests/api/videos/videos-views-cleaner.ts
+++ b/server/tests/api/videos/videos-views-cleaner.ts
@@ -61,14 +61,14 @@ describe('Test video views cleaner', function () {
61 { 61 {
62 for (const server of servers) { 62 for (const server of servers) {
63 const total = await countVideoViewsOf(server.internalServerNumber, videoIdServer1) 63 const total = await countVideoViewsOf(server.internalServerNumber, videoIdServer1)
64 expect(total).to.equal(2) 64 expect(total).to.equal(2, 'Server ' + server.serverNumber + ' does not have the correct amount of views')
65 } 65 }
66 } 66 }
67 67
68 { 68 {
69 for (const server of servers) { 69 for (const server of servers) {
70 const total = await countVideoViewsOf(server.internalServerNumber, videoIdServer2) 70 const total = await countVideoViewsOf(server.internalServerNumber, videoIdServer2)
71 expect(total).to.equal(2) 71 expect(total).to.equal(2, 'Server ' + server.serverNumber + ' does not have the correct amount of views')
72 } 72 }
73 } 73 }
74 }) 74 })
diff --git a/server/tests/plugins/plugin-helpers.ts b/server/tests/plugins/plugin-helpers.ts
index 0915603d0..e76d7917a 100644
--- a/server/tests/plugins/plugin-helpers.ts
+++ b/server/tests/plugins/plugin-helpers.ts
@@ -80,7 +80,7 @@ describe('Test plugin helpers', function () {
80 let videoUUIDServer1: string 80 let videoUUIDServer1: string
81 81
82 before(async function () { 82 before(async function () {
83 this.timeout(15000) 83 this.timeout(30000)
84 84
85 { 85 {
86 const res = await uploadVideoAndGetId({ server: servers[0], videoName: 'video server 1' }) 86 const res = await uploadVideoAndGetId({ server: servers[0], videoName: 'video server 1' })