aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/videos')
-rw-r--r--server/tests/api/videos/video-channels.ts5
-rw-r--r--server/tests/api/videos/videos-history.ts4
-rw-r--r--server/tests/api/videos/videos-views-cleaner.ts20
3 files changed, 12 insertions, 17 deletions
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts
index daf066eb1..e441ebbd4 100644
--- a/server/tests/api/videos/video-channels.ts
+++ b/server/tests/api/videos/video-channels.ts
@@ -9,7 +9,6 @@ import {
9 createUser, 9 createUser,
10 doubleFollow, 10 doubleFollow,
11 flushAndRunMultipleServers, 11 flushAndRunMultipleServers,
12 getActorImage,
13 getVideo, 12 getVideo,
14 getVideoChannelVideos, 13 getVideoChannelVideos,
15 setDefaultVideoChannel, 14 setDefaultVideoChannel,
@@ -268,7 +267,7 @@ describe('Test video channels', function () {
268 await testImage(server.url, 'avatar-resized', avatarPaths[server.port], '.png') 267 await testImage(server.url, 'avatar-resized', avatarPaths[server.port], '.png')
269 await testFileExistsOrNot(server, 'avatars', basename(avatarPaths[server.port]), true) 268 await testFileExistsOrNot(server, 'avatars', basename(avatarPaths[server.port]), true)
270 269
271 const row = await getActorImage(server.internalServerNumber, basename(avatarPaths[server.port])) 270 const row = await server.sqlCommand.getActorImage(basename(avatarPaths[server.port]))
272 expect(row.height).to.equal(ACTOR_IMAGES_SIZE.AVATARS.height) 271 expect(row.height).to.equal(ACTOR_IMAGES_SIZE.AVATARS.height)
273 expect(row.width).to.equal(ACTOR_IMAGES_SIZE.AVATARS.width) 272 expect(row.width).to.equal(ACTOR_IMAGES_SIZE.AVATARS.width)
274 } 273 }
@@ -294,7 +293,7 @@ describe('Test video channels', function () {
294 await testImage(server.url, 'banner-resized', bannerPaths[server.port]) 293 await testImage(server.url, 'banner-resized', bannerPaths[server.port])
295 await testFileExistsOrNot(server, 'avatars', basename(bannerPaths[server.port]), true) 294 await testFileExistsOrNot(server, 'avatars', basename(bannerPaths[server.port]), true)
296 295
297 const row = await getActorImage(server.internalServerNumber, basename(bannerPaths[server.port])) 296 const row = await server.sqlCommand.getActorImage(basename(bannerPaths[server.port]))
298 expect(row.height).to.equal(ACTOR_IMAGES_SIZE.BANNERS.height) 297 expect(row.height).to.equal(ACTOR_IMAGES_SIZE.BANNERS.height)
299 expect(row.width).to.equal(ACTOR_IMAGES_SIZE.BANNERS.width) 298 expect(row.width).to.equal(ACTOR_IMAGES_SIZE.BANNERS.width)
300 } 299 }
diff --git a/server/tests/api/videos/videos-history.ts b/server/tests/api/videos/videos-history.ts
index 731447135..9a7635c35 100644
--- a/server/tests/api/videos/videos-history.ts
+++ b/server/tests/api/videos/videos-history.ts
@@ -204,7 +204,7 @@ describe('Test videos history', function () {
204 it('Should not clean old history', async function () { 204 it('Should not clean old history', async function () {
205 this.timeout(50000) 205 this.timeout(50000)
206 206
207 killallServers([ server ]) 207 await killallServers([ server ])
208 208
209 await reRunServer(server, { history: { videos: { max_age: '10 days' } } }) 209 await reRunServer(server, { history: { videos: { max_age: '10 days' } } })
210 210
@@ -219,7 +219,7 @@ describe('Test videos history', function () {
219 it('Should clean old history', async function () { 219 it('Should clean old history', async function () {
220 this.timeout(50000) 220 this.timeout(50000)
221 221
222 killallServers([ server ]) 222 await killallServers([ server ])
223 223
224 await reRunServer(server, { history: { videos: { max_age: '5 seconds' } } }) 224 await reRunServer(server, { history: { videos: { max_age: '5 seconds' } } })
225 225
diff --git a/server/tests/api/videos/videos-views-cleaner.ts b/server/tests/api/videos/videos-views-cleaner.ts
index b89f33217..b6cde6b50 100644
--- a/server/tests/api/videos/videos-views-cleaner.ts
+++ b/server/tests/api/videos/videos-views-cleaner.ts
@@ -1,11 +1,9 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import * as chai from 'chai'
4import 'mocha' 3import 'mocha'
4import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 closeAllSequelize,
8 countVideoViewsOf,
9 doubleFollow, 7 doubleFollow,
10 flushAndRunMultipleServers, 8 flushAndRunMultipleServers,
11 killallServers, 9 killallServers,
@@ -50,7 +48,7 @@ describe('Test video views cleaner', function () {
50 it('Should not clean old video views', async function () { 48 it('Should not clean old video views', async function () {
51 this.timeout(50000) 49 this.timeout(50000)
52 50
53 killallServers([ servers[0] ]) 51 await killallServers([ servers[0] ])
54 52
55 await reRunServer(servers[0], { views: { videos: { remote: { max_age: '10 days' } } } }) 53 await reRunServer(servers[0], { views: { videos: { remote: { max_age: '10 days' } } } })
56 54
@@ -60,14 +58,14 @@ describe('Test video views cleaner', function () {
60 58
61 { 59 {
62 for (const server of servers) { 60 for (const server of servers) {
63 const total = await countVideoViewsOf(server.internalServerNumber, videoIdServer1) 61 const total = await server.sqlCommand.countVideoViewsOf(videoIdServer1)
64 expect(total).to.equal(2, 'Server ' + server.serverNumber + ' does not have the correct amount of views') 62 expect(total).to.equal(2, 'Server ' + server.serverNumber + ' does not have the correct amount of views')
65 } 63 }
66 } 64 }
67 65
68 { 66 {
69 for (const server of servers) { 67 for (const server of servers) {
70 const total = await countVideoViewsOf(server.internalServerNumber, videoIdServer2) 68 const total = await server.sqlCommand.countVideoViewsOf(videoIdServer2)
71 expect(total).to.equal(2, 'Server ' + server.serverNumber + ' does not have the correct amount of views') 69 expect(total).to.equal(2, 'Server ' + server.serverNumber + ' does not have the correct amount of views')
72 } 70 }
73 } 71 }
@@ -76,7 +74,7 @@ describe('Test video views cleaner', function () {
76 it('Should clean old video views', async function () { 74 it('Should clean old video views', async function () {
77 this.timeout(50000) 75 this.timeout(50000)
78 76
79 killallServers([ servers[0] ]) 77 await killallServers([ servers[0] ])
80 78
81 await reRunServer(servers[0], { views: { videos: { remote: { max_age: '5 seconds' } } } }) 79 await reRunServer(servers[0], { views: { videos: { remote: { max_age: '5 seconds' } } } })
82 80
@@ -86,23 +84,21 @@ describe('Test video views cleaner', function () {
86 84
87 { 85 {
88 for (const server of servers) { 86 for (const server of servers) {
89 const total = await countVideoViewsOf(server.internalServerNumber, videoIdServer1) 87 const total = await server.sqlCommand.countVideoViewsOf(videoIdServer1)
90 expect(total).to.equal(2) 88 expect(total).to.equal(2)
91 } 89 }
92 } 90 }
93 91
94 { 92 {
95 const totalServer1 = await countVideoViewsOf(servers[0].internalServerNumber, videoIdServer2) 93 const totalServer1 = await servers[0].sqlCommand.countVideoViewsOf(videoIdServer2)
96 expect(totalServer1).to.equal(0) 94 expect(totalServer1).to.equal(0)
97 95
98 const totalServer2 = await countVideoViewsOf(servers[1].internalServerNumber, videoIdServer2) 96 const totalServer2 = await servers[1].sqlCommand.countVideoViewsOf(videoIdServer2)
99 expect(totalServer2).to.equal(2) 97 expect(totalServer2).to.equal(2)
100 } 98 }
101 }) 99 })
102 100
103 after(async function () { 101 after(async function () {
104 await closeAllSequelize(servers)
105
106 await cleanupTests(servers) 102 await cleanupTests(servers)
107 }) 103 })
108}) 104})