Skip to content

Commit

Permalink
Update ffmpeg static version for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocobozzz committed Nov 9, 2020
1 parent cfe3d3a commit 1a98020
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
- name: Setup system dependencies
run: |
sudo apt-get install postgresql-client-common redis-tools parallel
wget --quiet --no-check-certificate "https://download.cpy.re/ffmpeg/ffmpeg-release-4.0.3-64bit-static.tar.xz"
wget --quiet --no-check-certificate "https://download.cpy.re/ffmpeg/ffmpeg-release-4.3.1-64bit-static.tar.xz"
tar xf ffmpeg-release-4.0.3-64bit-static.tar.xz
mkdir -p $HOME/bin
cp ffmpeg-*/{ffmpeg,ffprobe} $HOME/bin
Expand Down
2 changes: 1 addition & 1 deletion server/initializers/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ const CONSTRAINTS_FIELDS = {
}
}

let VIEW_LIFETIME = {
const VIEW_LIFETIME = {
VIDEO: 60000 * 60, // 1 hour
LIVE: 60000 * 5 // 5 minutes
}
Expand Down
6 changes: 4 additions & 2 deletions server/lib/activitypub/process/process-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,17 @@ async function processCreateView (activity: ActivityView | ActivityCreate, byAct
}
const { video } = await getOrCreateVideoAndAccountAndChannel(options)

if (!video.isLive) {
await Redis.Instance.addVideoView(video.id)
}

if (video.isOwned()) {
// Our live manager will increment the counter and send the view to followers
if (video.isLive) {
LiveManager.Instance.addViewTo(video.id)
return
}

await Redis.Instance.addVideoView(video.id)

// Forward the view but don't resend the activity to the sender
const exceptions = [ byActor ]
await forwardVideoRelatedActivity(activity, undefined, exceptions, video)
Expand Down
6 changes: 3 additions & 3 deletions server/tests/api/live/live.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ describe('Test live', function () {
const live: LiveVideo = resLive.body

if (server.url === servers[0].url) {
expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':1936/live')
expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + server.rtmpPort + '/live')
expect(live.streamKey).to.not.be.empty
} else {
expect(live.rtmpUrl).to.be.null
Expand Down Expand Up @@ -185,7 +185,7 @@ describe('Test live', function () {
const live: LiveVideo = res.body

if (server.url === servers[0].url) {
expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':1936/live')
expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + server.rtmpPort + '/live')
expect(live.streamKey).to.not.be.empty
} else {
expect(live.rtmpUrl).to.be.null
Expand Down Expand Up @@ -216,7 +216,7 @@ describe('Test live', function () {
let rtmpUrl: string

before(function () {
rtmpUrl = 'rtmp://' + servers[0].hostname + ':1936'
rtmpUrl = 'rtmp://' + servers[0].hostname + ':' + server.rtmpPort + ''
})

async function createLiveWrapper () {
Expand Down
4 changes: 2 additions & 2 deletions server/tests/api/videos/videos-views-cleaner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ describe('Test video views cleaner', function () {
{
for (const server of servers) {
const total = await countVideoViewsOf(server.internalServerNumber, videoIdServer1)
expect(total).to.equal(2)
expect(total).to.equal(2, 'Server ' + server.serverNumber + ' does not have the correct amount of views')
}
}

{
for (const server of servers) {
const total = await countVideoViewsOf(server.internalServerNumber, videoIdServer2)
expect(total).to.equal(2)
expect(total).to.equal(2, 'Server ' + server.serverNumber + ' does not have the correct amount of views')
}
}
})
Expand Down
2 changes: 1 addition & 1 deletion server/tests/plugins/plugin-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ describe('Test plugin helpers', function () {
let videoUUIDServer1: string

before(async function () {
this.timeout(15000)
this.timeout(30000)

{
const res = await uploadVideoAndGetId({ server: servers[0], videoName: 'video server 1' })
Expand Down
15 changes: 15 additions & 0 deletions shared/extra-utils/server/servers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { copy, pathExists, readdir, readFile, remove } from 'fs-extra'
import { expect } from 'chai'
import { VideoChannel } from '../../models/videos'
import { randomInt } from '../../core-utils/miscs/miscs'
import { isNpmPluginNameValid } from '@server/helpers/custom-validators/plugins'

interface ServerInfo {
app: ChildProcess
Expand All @@ -16,6 +17,8 @@ interface ServerInfo {
hostname: string
port: number

rtmpPort: number

parallel: boolean
internalServerNumber: number
serverNumber: number
Expand Down Expand Up @@ -95,10 +98,18 @@ function randomServer () {
return randomInt(low, high)
}

function randomRTMP () {
const low = 1900
const high = 2100

return randomInt(low, high)
}

async function flushAndRunServer (serverNumber: number, configOverride?: Object, args = []) {
const parallel = parallelTests()

const internalServerNumber = parallel ? randomServer() : serverNumber
const rtmpPort = parallel ? randomRTMP() : null
const port = 9000 + internalServerNumber

await flushTests(internalServerNumber)
Expand All @@ -107,6 +118,7 @@ async function flushAndRunServer (serverNumber: number, configOverride?: Object,
app: null,
port,
internalServerNumber,
rtmpPort,
parallel,
serverNumber,
url: `http://localhost:${port}`,
Expand Down Expand Up @@ -178,6 +190,9 @@ async function runServer (server: ServerInfo, configOverrideArg?: any, args = []
},
admin: {
email: `admin${server.internalServerNumber}@example.com`
},
live: {
port: server.rtmpPort
}
})
}
Expand Down

0 comments on commit 1a98020

Please sign in to comment.