diff options
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/api/server/handle-down.ts | 14 | ||||
-rw-r--r-- | server/tests/api/server/jobs.ts | 11 | ||||
-rw-r--r-- | server/tests/real-world/real-world.ts | 2 | ||||
-rw-r--r-- | server/tests/utils/server/jobs.ts | 2 |
4 files changed, 18 insertions, 11 deletions
diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.ts index 69609b4fc..84d310ae6 100644 --- a/server/tests/api/server/handle-down.ts +++ b/server/tests/api/server/handle-down.ts | |||
@@ -6,15 +6,21 @@ import { JobState } from '../../../../shared/models' | |||
6 | import { VideoPrivacy } from '../../../../shared/models/videos' | 6 | import { VideoPrivacy } from '../../../../shared/models/videos' |
7 | import { VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' | 7 | import { VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' |
8 | import { completeVideoCheck, getVideo, immutableAssign, reRunServer, viewVideo } from '../../utils' | 8 | import { completeVideoCheck, getVideo, immutableAssign, reRunServer, viewVideo } from '../../utils' |
9 | |||
10 | import { | 9 | import { |
11 | flushAndRunMultipleServers, flushTests, getVideosList, killallServers, ServerInfo, setAccessTokensToServers, uploadVideo, | 10 | flushAndRunMultipleServers, |
11 | getVideosList, | ||
12 | killallServers, | ||
13 | ServerInfo, | ||
14 | setAccessTokensToServers, | ||
15 | uploadVideo, | ||
12 | wait | 16 | wait |
13 | } from '../../utils/index' | 17 | } from '../../utils/index' |
14 | import { follow, getFollowersListPaginationAndSort } from '../../utils/server/follows' | 18 | import { follow, getFollowersListPaginationAndSort } from '../../utils/server/follows' |
15 | import { getJobsListPaginationAndSort, waitJobs } from '../../utils/server/jobs' | 19 | import { getJobsListPaginationAndSort, waitJobs } from '../../utils/server/jobs' |
16 | import { | 20 | import { |
17 | addVideoCommentReply, addVideoCommentThread, getVideoCommentThreads, | 21 | addVideoCommentReply, |
22 | addVideoCommentThread, | ||
23 | getVideoCommentThreads, | ||
18 | getVideoThreadComments | 24 | getVideoThreadComments |
19 | } from '../../utils/videos/video-comments' | 25 | } from '../../utils/videos/video-comments' |
20 | 26 | ||
@@ -146,7 +152,7 @@ describe('Test handle downs', function () { | |||
146 | }) | 152 | }) |
147 | 153 | ||
148 | it('Should not have pending/processing jobs anymore', async function () { | 154 | it('Should not have pending/processing jobs anymore', async function () { |
149 | const states: JobState[] = [ 'inactive', 'active' ] | 155 | const states: JobState[] = [ 'waiting', 'active' ] |
150 | 156 | ||
151 | for (const state of states) { | 157 | for (const state of states) { |
152 | const res = await getJobsListPaginationAndSort(servers[ 0 ].url, servers[ 0 ].accessToken, state,0, 50, '-createdAt') | 158 | const res = await getJobsListPaginationAndSort(servers[ 0 ].url, servers[ 0 ].accessToken, state,0, 50, '-createdAt') |
diff --git a/server/tests/api/server/jobs.ts b/server/tests/api/server/jobs.ts index 81e389de6..f248c5521 100644 --- a/server/tests/api/server/jobs.ts +++ b/server/tests/api/server/jobs.ts | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | import * as chai from 'chai' | 3 | import * as chai from 'chai' |
4 | import 'mocha' | 4 | import 'mocha' |
5 | import { flushTests, killallServers, ServerInfo, setAccessTokensToServers, wait } from '../../utils/index' | 5 | import { killallServers, ServerInfo, setAccessTokensToServers } from '../../utils/index' |
6 | import { doubleFollow } from '../../utils/server/follows' | 6 | import { doubleFollow } from '../../utils/server/follows' |
7 | import { getJobsList, getJobsListPaginationAndSort, waitJobs } from '../../utils/server/jobs' | 7 | import { getJobsList, getJobsListPaginationAndSort, waitJobs } from '../../utils/server/jobs' |
8 | import { flushAndRunMultipleServers } from '../../utils/server/servers' | 8 | import { flushAndRunMultipleServers } from '../../utils/server/servers' |
@@ -35,22 +35,23 @@ describe('Test jobs', function () { | |||
35 | }) | 35 | }) |
36 | 36 | ||
37 | it('Should list jobs', async function () { | 37 | it('Should list jobs', async function () { |
38 | const res = await getJobsList(servers[1].url, servers[1].accessToken, 'complete') | 38 | const res = await getJobsList(servers[1].url, servers[1].accessToken, 'completed') |
39 | expect(res.body.total).to.be.above(2) | 39 | expect(res.body.total).to.be.above(2) |
40 | expect(res.body.data).to.have.length.above(2) | 40 | expect(res.body.data).to.have.length.above(2) |
41 | }) | 41 | }) |
42 | 42 | ||
43 | it('Should list jobs with sort and pagination', async function () { | 43 | it('Should list jobs with sort and pagination', async function () { |
44 | const res = await getJobsListPaginationAndSort(servers[1].url, servers[1].accessToken, 'complete', 1, 1, 'createdAt') | 44 | const res = await getJobsListPaginationAndSort(servers[1].url, servers[1].accessToken, 'completed', 1, 1, 'createdAt') |
45 | expect(res.body.total).to.be.above(2) | 45 | expect(res.body.total).to.be.above(2) |
46 | expect(res.body.data).to.have.lengthOf(1) | 46 | expect(res.body.data).to.have.lengthOf(1) |
47 | 47 | ||
48 | const job = res.body.data[0] | 48 | const job = res.body.data[0] |
49 | 49 | ||
50 | expect(job.state).to.equal('complete') | 50 | expect(job.state).to.equal('completed') |
51 | expect(job.type).to.equal('activitypub-http-unicast') | 51 | expect(job.type).to.equal('activitypub-http-unicast') |
52 | expect(dateIsValid(job.createdAt)).to.be.true | 52 | expect(dateIsValid(job.createdAt)).to.be.true |
53 | expect(dateIsValid(job.updatedAt)).to.be.true | 53 | expect(dateIsValid(job.processedOn)).to.be.true |
54 | expect(dateIsValid(job.finishedOn)).to.be.true | ||
54 | }) | 55 | }) |
55 | 56 | ||
56 | after(async function () { | 57 | after(async function () { |
diff --git a/server/tests/real-world/real-world.ts b/server/tests/real-world/real-world.ts index b7375f778..a96469b11 100644 --- a/server/tests/real-world/real-world.ts +++ b/server/tests/real-world/real-world.ts | |||
@@ -347,7 +347,7 @@ function goodbye () { | |||
347 | } | 347 | } |
348 | 348 | ||
349 | async function isTherePendingRequests (servers: ServerInfo[]) { | 349 | async function isTherePendingRequests (servers: ServerInfo[]) { |
350 | const states: JobState[] = [ 'inactive', 'active', 'delayed' ] | 350 | const states: JobState[] = [ 'waiting', 'active', 'delayed' ] |
351 | const tasks: Promise<any>[] = [] | 351 | const tasks: Promise<any>[] = [] |
352 | let pendingRequests = false | 352 | let pendingRequests = false |
353 | 353 | ||
diff --git a/server/tests/utils/server/jobs.ts b/server/tests/utils/server/jobs.ts index 375e76f93..c9cb8d3a3 100644 --- a/server/tests/utils/server/jobs.ts +++ b/server/tests/utils/server/jobs.ts | |||
@@ -33,7 +33,7 @@ async function waitJobs (serversArg: ServerInfo[] | ServerInfo) { | |||
33 | if (Array.isArray(serversArg) === false) servers = [ serversArg as ServerInfo ] | 33 | if (Array.isArray(serversArg) === false) servers = [ serversArg as ServerInfo ] |
34 | else servers = serversArg as ServerInfo[] | 34 | else servers = serversArg as ServerInfo[] |
35 | 35 | ||
36 | const states: JobState[] = [ 'inactive', 'active', 'delayed' ] | 36 | const states: JobState[] = [ 'waiting', 'active', 'delayed' ] |
37 | const tasks: Promise<any>[] = [] | 37 | const tasks: Promise<any>[] = [] |
38 | let pendingRequests: boolean | 38 | let pendingRequests: boolean |
39 | 39 | ||