From 94831479f5facff9469540a3d49dd347b88bdf5a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 10 Jul 2018 17:02:20 +0200 Subject: Migrate to bull --- server/tests/api/server/handle-down.ts | 14 ++++++++++---- server/tests/api/server/jobs.ts | 11 ++++++----- 2 files changed, 16 insertions(+), 9 deletions(-) (limited to 'server/tests/api') 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' import { VideoPrivacy } from '../../../../shared/models/videos' import { VideoCommentThreadTree } from '../../../../shared/models/videos/video-comment.model' import { completeVideoCheck, getVideo, immutableAssign, reRunServer, viewVideo } from '../../utils' - import { - flushAndRunMultipleServers, flushTests, getVideosList, killallServers, ServerInfo, setAccessTokensToServers, uploadVideo, + flushAndRunMultipleServers, + getVideosList, + killallServers, + ServerInfo, + setAccessTokensToServers, + uploadVideo, wait } from '../../utils/index' import { follow, getFollowersListPaginationAndSort } from '../../utils/server/follows' import { getJobsListPaginationAndSort, waitJobs } from '../../utils/server/jobs' import { - addVideoCommentReply, addVideoCommentThread, getVideoCommentThreads, + addVideoCommentReply, + addVideoCommentThread, + getVideoCommentThreads, getVideoThreadComments } from '../../utils/videos/video-comments' @@ -146,7 +152,7 @@ describe('Test handle downs', function () { }) it('Should not have pending/processing jobs anymore', async function () { - const states: JobState[] = [ 'inactive', 'active' ] + const states: JobState[] = [ 'waiting', 'active' ] for (const state of states) { 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 @@ import * as chai from 'chai' import 'mocha' -import { flushTests, killallServers, ServerInfo, setAccessTokensToServers, wait } from '../../utils/index' +import { killallServers, ServerInfo, setAccessTokensToServers } from '../../utils/index' import { doubleFollow } from '../../utils/server/follows' import { getJobsList, getJobsListPaginationAndSort, waitJobs } from '../../utils/server/jobs' import { flushAndRunMultipleServers } from '../../utils/server/servers' @@ -35,22 +35,23 @@ describe('Test jobs', function () { }) it('Should list jobs', async function () { - const res = await getJobsList(servers[1].url, servers[1].accessToken, 'complete') + const res = await getJobsList(servers[1].url, servers[1].accessToken, 'completed') expect(res.body.total).to.be.above(2) expect(res.body.data).to.have.length.above(2) }) it('Should list jobs with sort and pagination', async function () { - const res = await getJobsListPaginationAndSort(servers[1].url, servers[1].accessToken, 'complete', 1, 1, 'createdAt') + const res = await getJobsListPaginationAndSort(servers[1].url, servers[1].accessToken, 'completed', 1, 1, 'createdAt') expect(res.body.total).to.be.above(2) expect(res.body.data).to.have.lengthOf(1) const job = res.body.data[0] - expect(job.state).to.equal('complete') + expect(job.state).to.equal('completed') expect(job.type).to.equal('activitypub-http-unicast') expect(dateIsValid(job.createdAt)).to.be.true - expect(dateIsValid(job.updatedAt)).to.be.true + expect(dateIsValid(job.processedOn)).to.be.true + expect(dateIsValid(job.finishedOn)).to.be.true }) after(async function () { -- cgit v1.2.3