Fix stats tests
This commit is contained in:
parent
d7764e2eb7
commit
94d721efdc
|
@ -10,11 +10,8 @@ fi
|
||||||
killall -q peertube || true
|
killall -q peertube || true
|
||||||
|
|
||||||
retries=3
|
retries=3
|
||||||
jobs=2
|
|
||||||
|
|
||||||
runTest () {
|
runTest () {
|
||||||
retries=3
|
|
||||||
|
|
||||||
jobname=$1
|
jobname=$1
|
||||||
shift
|
shift
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,11 @@ import {
|
||||||
testFfmpegStreamError,
|
testFfmpegStreamError,
|
||||||
updateCustomSubConfig,
|
updateCustomSubConfig,
|
||||||
updateVideo,
|
updateVideo,
|
||||||
|
wait,
|
||||||
waitJobs,
|
waitJobs,
|
||||||
waitUntilLiveEnded,
|
waitUntilLiveEnded,
|
||||||
waitUntilLivePublished
|
waitUntilLivePublished,
|
||||||
|
waitUntilLiveSaved
|
||||||
} from '../../../../shared/extra-utils'
|
} from '../../../../shared/extra-utils'
|
||||||
|
|
||||||
const expect = chai.expect
|
const expect = chai.expect
|
||||||
|
@ -81,6 +83,12 @@ describe('Save replay setting', function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function waitUntilLiveSavedOnAllServers (videoId: string) {
|
||||||
|
for (const server of servers) {
|
||||||
|
await waitUntilLiveSaved(server.url, server.accessToken, videoId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
before(async function () {
|
before(async function () {
|
||||||
this.timeout(120000)
|
this.timeout(120000)
|
||||||
|
|
||||||
|
@ -158,8 +166,6 @@ describe('Save replay setting', function () {
|
||||||
await checkVideosExist(liveVideoUUID, false, HttpStatusCode.OK_200)
|
await checkVideosExist(liveVideoUUID, false, HttpStatusCode.OK_200)
|
||||||
await checkVideoState(liveVideoUUID, VideoState.LIVE_ENDED)
|
await checkVideoState(liveVideoUUID, VideoState.LIVE_ENDED)
|
||||||
|
|
||||||
await waitJobs(servers)
|
|
||||||
|
|
||||||
// No resolutions saved since we did not save replay
|
// No resolutions saved since we did not save replay
|
||||||
await checkLiveCleanup(servers[0], liveVideoUUID, [])
|
await checkLiveCleanup(servers[0], liveVideoUUID, [])
|
||||||
})
|
})
|
||||||
|
@ -188,6 +194,8 @@ describe('Save replay setting', function () {
|
||||||
await getVideo(servers[0].url, liveVideoUUID, HttpStatusCode.UNAUTHORIZED_401)
|
await getVideo(servers[0].url, liveVideoUUID, HttpStatusCode.UNAUTHORIZED_401)
|
||||||
await getVideo(servers[1].url, liveVideoUUID, HttpStatusCode.NOT_FOUND_404)
|
await getVideo(servers[1].url, liveVideoUUID, HttpStatusCode.NOT_FOUND_404)
|
||||||
|
|
||||||
|
await wait(5000)
|
||||||
|
await waitJobs(servers)
|
||||||
await checkLiveCleanup(servers[0], liveVideoUUID, [])
|
await checkLiveCleanup(servers[0], liveVideoUUID, [])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -208,6 +216,7 @@ describe('Save replay setting', function () {
|
||||||
removeVideo(servers[0].url, servers[0].accessToken, liveVideoUUID)
|
removeVideo(servers[0].url, servers[0].accessToken, liveVideoUUID)
|
||||||
])
|
])
|
||||||
|
|
||||||
|
await wait(5000)
|
||||||
await waitJobs(servers)
|
await waitJobs(servers)
|
||||||
|
|
||||||
await checkVideosExist(liveVideoUUID, false, HttpStatusCode.NOT_FOUND_404)
|
await checkVideosExist(liveVideoUUID, false, HttpStatusCode.NOT_FOUND_404)
|
||||||
|
@ -245,6 +254,7 @@ describe('Save replay setting', function () {
|
||||||
|
|
||||||
await stopFfmpeg(ffmpegCommand)
|
await stopFfmpeg(ffmpegCommand)
|
||||||
|
|
||||||
|
await waitUntilLiveSavedOnAllServers(liveVideoUUID)
|
||||||
await waitJobs(servers)
|
await waitJobs(servers)
|
||||||
|
|
||||||
// Live has been transcoded
|
// Live has been transcoded
|
||||||
|
@ -292,6 +302,8 @@ describe('Save replay setting', function () {
|
||||||
await getVideo(servers[0].url, liveVideoUUID, HttpStatusCode.UNAUTHORIZED_401)
|
await getVideo(servers[0].url, liveVideoUUID, HttpStatusCode.UNAUTHORIZED_401)
|
||||||
await getVideo(servers[1].url, liveVideoUUID, HttpStatusCode.NOT_FOUND_404)
|
await getVideo(servers[1].url, liveVideoUUID, HttpStatusCode.NOT_FOUND_404)
|
||||||
|
|
||||||
|
await wait(5000)
|
||||||
|
await waitJobs(servers)
|
||||||
await checkLiveCleanup(servers[0], liveVideoUUID, [ 720 ])
|
await checkLiveCleanup(servers[0], liveVideoUUID, [ 720 ])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -311,6 +323,7 @@ describe('Save replay setting', function () {
|
||||||
testFfmpegStreamError(ffmpegCommand, true)
|
testFfmpegStreamError(ffmpegCommand, true)
|
||||||
])
|
])
|
||||||
|
|
||||||
|
await wait(5000)
|
||||||
await waitJobs(servers)
|
await waitJobs(servers)
|
||||||
|
|
||||||
await checkVideosExist(liveVideoUUID, false, HttpStatusCode.NOT_FOUND_404)
|
await checkVideosExist(liveVideoUUID, false, HttpStatusCode.NOT_FOUND_404)
|
||||||
|
|
|
@ -314,7 +314,7 @@ describe('Test user notifications', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should not send a notification before the video is published', async function () {
|
it('Should not send a notification before the video is published', async function () {
|
||||||
this.timeout(40000)
|
this.timeout(50000)
|
||||||
|
|
||||||
const updateAt = new Date(new Date().getTime() + 1000000)
|
const updateAt = new Date(new Date().getTime() + 1000000)
|
||||||
|
|
||||||
|
|
|
@ -195,12 +195,14 @@ describe('Test stats (excluding redundancy)', function () {
|
||||||
|
|
||||||
await waitJobs(servers)
|
await waitJobs(servers)
|
||||||
|
|
||||||
|
await wait(6000)
|
||||||
|
|
||||||
const res2 = await getStats(servers[1].url)
|
const res2 = await getStats(servers[1].url)
|
||||||
const second: ServerStats = res2.body
|
const second: ServerStats = res2.body
|
||||||
|
|
||||||
expect(second.totalActivityPubMessagesProcessed).to.be.greaterThan(first.totalActivityPubMessagesProcessed)
|
expect(second.totalActivityPubMessagesProcessed).to.be.greaterThan(first.totalActivityPubMessagesProcessed)
|
||||||
|
|
||||||
await wait(5000)
|
await wait(6000)
|
||||||
|
|
||||||
const res3 = await getStats(servers[1].url)
|
const res3 = await getStats(servers[1].url)
|
||||||
const third: ServerStats = res3.body
|
const third: ServerStats = res3.body
|
||||||
|
|
|
@ -164,6 +164,17 @@ async function waitUntilLiveState (url: string, token: string, videoId: number |
|
||||||
} while (video.state.id !== state)
|
} while (video.state.id !== state)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function waitUntilLiveSaved (url: string, token: string, videoId: number | string) {
|
||||||
|
let video: VideoDetails
|
||||||
|
|
||||||
|
do {
|
||||||
|
const res = await getVideoWithToken(url, token, videoId)
|
||||||
|
video = res.body
|
||||||
|
|
||||||
|
await wait(500)
|
||||||
|
} while (video.isLive === true && video.state.id !== VideoState.PUBLISHED)
|
||||||
|
}
|
||||||
|
|
||||||
async function checkLiveCleanup (server: ServerInfo, videoUUID: string, resolutions: number[] = []) {
|
async function checkLiveCleanup (server: ServerInfo, videoUUID: string, resolutions: number[] = []) {
|
||||||
const basePath = buildServerDirectory(server, 'streaming-playlists')
|
const basePath = buildServerDirectory(server, 'streaming-playlists')
|
||||||
const hlsPath = join(basePath, 'hls', videoUUID)
|
const hlsPath = join(basePath, 'hls', videoUUID)
|
||||||
|
@ -203,6 +214,7 @@ async function getPlaylistsCount (server: ServerInfo, videoUUID: string) {
|
||||||
export {
|
export {
|
||||||
getLive,
|
getLive,
|
||||||
getPlaylistsCount,
|
getPlaylistsCount,
|
||||||
|
waitUntilLiveSaved,
|
||||||
waitUntilLivePublished,
|
waitUntilLivePublished,
|
||||||
updateLive,
|
updateLive,
|
||||||
createLive,
|
createLive,
|
||||||
|
|
Loading…
Reference in New Issue