-/* tslint:disable:no-unused-expression */
+/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
import * as chai from 'chai'
import 'mocha'
import {
+ cleanupTests,
+ closeAllSequelize,
+ countVideoViewsOf,
+ doubleFollow,
flushAndRunMultipleServers,
- flushTests,
killallServers,
reRunServer,
- runServer,
ServerInfo,
setAccessTokensToServers,
- uploadVideo, uploadVideoAndGetId, viewVideo, wait, countVideoViewsOf, doubleFollow, waitJobs
-} from '../../../../shared/utils'
-import { getVideosOverview } from '../../../../shared/utils/overviews/overviews'
-import { VideosOverview } from '../../../../shared/models/overviews'
-import { listMyVideosHistory } from '../../../../shared/utils/videos/video-history'
+ uploadVideoAndGetId,
+ viewVideo,
+ wait,
+ waitJobs
+} from '../../../../shared/extra-utils'
const expect = chai.expect
before(async function () {
this.timeout(50000)
- await flushTests()
-
servers = await flushAndRunMultipleServers(2)
await setAccessTokensToServers(servers)
{
for (const server of servers) {
- const total = await countVideoViewsOf(server.serverNumber, videoIdServer1)
+ const total = await countVideoViewsOf(server.internalServerNumber, videoIdServer1)
expect(total).to.equal(2)
}
}
{
for (const server of servers) {
- const total = await countVideoViewsOf(server.serverNumber, videoIdServer2)
+ const total = await countVideoViewsOf(server.internalServerNumber, videoIdServer2)
expect(total).to.equal(2)
}
}
it('Should clean old video views', async function () {
this.timeout(50000)
- this.timeout(50000)
-
killallServers([ servers[0] ])
await reRunServer(servers[0], { views: { videos: { remote: { max_age: '5 seconds' } } } })
{
for (const server of servers) {
- const total = await countVideoViewsOf(server.serverNumber, videoIdServer1)
+ const total = await countVideoViewsOf(server.internalServerNumber, videoIdServer1)
expect(total).to.equal(2)
}
}
{
- const totalServer1 = await countVideoViewsOf(servers[0].serverNumber, videoIdServer2)
+ const totalServer1 = await countVideoViewsOf(servers[0].internalServerNumber, videoIdServer2)
expect(totalServer1).to.equal(0)
- const totalServer2 = await countVideoViewsOf(servers[1].serverNumber, videoIdServer2)
+ const totalServer2 = await countVideoViewsOf(servers[1].internalServerNumber, videoIdServer2)
expect(totalServer2).to.equal(2)
}
})
after(async function () {
- killallServers(servers)
+ await closeAllSequelize(servers)
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
+ await cleanupTests(servers)
})
})