Skip to content

Commit

Permalink
Merge branch 'ci/add-dragonfly-backend-to-tests' of https://github.co…
Browse files Browse the repository at this point in the history
…m/taskforcesh/bullmq into ci/add-dragonfly-backend-to-tests
  • Loading branch information
manast committed Oct 24, 2023
2 parents 6f4d0b2 + afd4d38 commit 6962b30
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 33 deletions.
3 changes: 1 addition & 2 deletions tests/test_clean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ import {
} from '../src/classes';
import { delay, removeAllQueueData } from '../src/utils';

const prefix = process.env.BULLMQ_TEST_PREFIX || 'bull';

describe('Cleaner', () => {
const prefix = process.env.BULLMQ_TEST_PREFIX || 'bull';
let queue: Queue;
let queueEvents: QueueEvents;
let queueName: string;
Expand Down
3 changes: 1 addition & 2 deletions tests/test_connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ import { v4 } from 'uuid';
import { Queue, Job, Worker, QueueBase } from '../src/classes';
import { removeAllQueueData } from '../src/utils';

const prefix = process.env.BULLMQ_TEST_PREFIX || 'bull';

describe('connection', () => {
const prefix = process.env.BULLMQ_TEST_PREFIX || 'bull';
let queue: Queue;
let queueName: string;
const connection = { host: 'localhost' };
Expand Down
3 changes: 1 addition & 2 deletions tests/test_delay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import { v4 } from 'uuid';
import { Queue, Job, Worker, QueueEvents } from '../src/classes';
import { removeAllQueueData, delay } from '../src/utils';

const prefix = process.env.BULLMQ_TEST_PREFIX || 'bull';

describe('Delayed jobs', function () {
const prefix = process.env.BULLMQ_TEST_PREFIX || 'bull';
this.timeout(15000);

let queue: Queue;
Expand Down
17 changes: 10 additions & 7 deletions tests/test_flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1306,8 +1306,11 @@ describe('flows', () => {

describe('when custom prefix is set in flow producer', async () => {
it('uses default prefix to add jobs', async () => {
const prefix = '{bull}';
const childrenQueue = new Queue(queueName, { prefix, connection });
const customPrefix = '{bull}';
const childrenQueue = new Queue(queueName, {
prefix: customPrefix,
connection,
});

const name = 'child-job';
const values = [{ bar: 'something' }];
Expand Down Expand Up @@ -1356,16 +1359,16 @@ describe('flows', () => {

const parentWorker = new Worker(parentQueueName, parentProcessor, {
connection,
prefix,
prefix: customPrefix,
});
const childrenWorker = new Worker(queueName, childrenProcessor, {
connection,
prefix,
prefix: customPrefix,
});
await parentWorker.waitUntilReady();
await childrenWorker.waitUntilReady();

const flow = new FlowProducer({ prefix: '{bull}', connection });
const flow = new FlowProducer({ prefix: customPrefix, connection });
const tree = await flow.add({
name: 'parent-job',
queueName: parentQueueName,
Expand Down Expand Up @@ -1393,8 +1396,8 @@ describe('flows', () => {

await flow.close();
await childrenQueue.close();
await removeAllQueueData(new IORedis(), parentQueueName, prefix);
await removeAllQueueData(new IORedis(), queueName, prefix);
await removeAllQueueData(new IORedis(), parentQueueName, customPrefix);
await removeAllQueueData(new IORedis(), queueName, customPrefix);
});
});

Expand Down
3 changes: 1 addition & 2 deletions tests/test_getters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import { v4 } from 'uuid';
import { FlowProducer, Queue, QueueEvents, Worker } from '../src/classes';
import { delay, removeAllQueueData } from '../src/utils';

const prefix = process.env.BULLMQ_TEST_PREFIX || 'bull';

describe('Jobs getters', function () {
const prefix = process.env.BULLMQ_TEST_PREFIX || 'bull';
let queue: Queue;
let queueName: string;
const connection = { host: 'localhost' };
Expand Down
3 changes: 1 addition & 2 deletions tests/test_job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ import { Job, Queue, QueueEvents, Worker } from '../src/classes';
import { JobsOptions } from '../src/types';
import { delay, getParentKey, removeAllQueueData } from '../src/utils';

const prefix = process.env.BULLMQ_TEST_PREFIX || 'bull';

describe('Job', function () {
const prefix = process.env.BULLMQ_TEST_PREFIX || 'bull';
let queue: Queue;
let queueName: string;
const connection = { host: 'localhost' };
Expand Down
3 changes: 1 addition & 2 deletions tests/test_metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ const ONE_SECOND = 1000;
const ONE_MINUTE = 60 * ONE_SECOND;
const ONE_HOUR = 60 * ONE_MINUTE;

const prefix = process.env.BULLMQ_TEST_PREFIX || 'bull';

describe('metrics', function () {
const prefix = process.env.BULLMQ_TEST_PREFIX || 'bull';
this.timeout(10000);
let repeat: Repeat;
let queue: Queue;
Expand Down
3 changes: 1 addition & 2 deletions tests/test_obliterate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import { v4 } from 'uuid';
import { Queue, QueueEvents, FlowProducer, Worker, Job } from '../src/classes';
import { delay, removeAllQueueData } from '../src/utils';

const prefix = process.env.BULLMQ_TEST_PREFIX || 'bull';

describe('Obliterate', function () {
const prefix = process.env.BULLMQ_TEST_PREFIX || 'bull';
let queue: Queue;
let queueEvents: QueueEvents;
let queueName: string;
Expand Down
4 changes: 2 additions & 2 deletions tests/test_pause.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { v4 } from 'uuid';
import { Job, Queue, QueueEvents, Worker } from '../src/classes';
import { delay, removeAllQueueData } from '../src/utils';

const prefix = process.env.BULLMQ_TEST_PREFIX || 'bull';

describe('Pause', function () {
const prefix = process.env.BULLMQ_TEST_PREFIX || 'bull';

let queue: Queue;
let queueName: string;
let queueEvents: QueueEvents;
Expand Down
3 changes: 1 addition & 2 deletions tests/test_queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ import { v4 } from 'uuid';
import { FlowProducer, Job, Queue, Worker } from '../src/classes';
import { delay, removeAllQueueData } from '../src/utils';

const prefix = process.env.BULLMQ_TEST_PREFIX || 'bull';

describe('queues', function () {
const prefix = process.env.BULLMQ_TEST_PREFIX || 'bull';
const sandbox = sinon.createSandbox();

let queue: Queue;
Expand Down
3 changes: 1 addition & 2 deletions tests/test_rate_limiter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ import {
} from '../src/classes';
import { delay, removeAllQueueData } from '../src/utils';

const prefix = process.env.BULLMQ_TEST_PREFIX || 'bull';

describe('Rate Limiter', function () {
const prefix = process.env.BULLMQ_TEST_PREFIX || 'bull';
let queue: Queue;
let queueName: string;
let queueEvents: QueueEvents;
Expand Down
3 changes: 1 addition & 2 deletions tests/test_repeat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ const ONE_DAY = 24 * ONE_HOUR;

const NoopProc = async (job: Job) => {};

const prefix = process.env.BULLMQ_TEST_PREFIX || 'bull';

describe('repeat', function () {
const prefix = process.env.BULLMQ_TEST_PREFIX || 'bull';
this.timeout(10000);
let repeat: Repeat;
let queue: Queue;
Expand Down
3 changes: 1 addition & 2 deletions tests/test_sandboxed_process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import { delay, removeAllQueueData } from '../src/utils';
import { Child } from '../src/classes/child';
const { stdout, stderr } = require('test-console');

const prefix = process.env.BULLMQ_TEST_PREFIX || 'bull';

describe('Sandboxed process using child processes', () => {
sandboxProcessTests();
});
Expand All @@ -22,6 +20,7 @@ function sandboxProcessTests(
{ useWorkerThreads } = { useWorkerThreads: false },
) {
describe('sandboxed process', () => {
const prefix = process.env.BULLMQ_TEST_PREFIX || 'bull';
let queue: Queue;
let queueEvents: QueueEvents;
let queueName: string;
Expand Down
3 changes: 1 addition & 2 deletions tests/test_stalled_jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import { beforeEach, describe, it } from 'mocha';
import { v4 } from 'uuid';
import { expect } from 'chai';

const prefix = process.env.BULLMQ_TEST_PREFIX || 'bull';

describe('stalled jobs', function () {
const prefix = process.env.BULLMQ_TEST_PREFIX || 'bull';
let queue: Queue;
let queueName: string;

Expand Down

0 comments on commit 6962b30

Please sign in to comment.