Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(fpof): make sure parent is moved to failed immediately #2241

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions tests/test_flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2129,15 +2129,15 @@ describe('flows', () => {
let grandChildrenProcessor,
processedGrandChildren = 0;
const processingChildren = new Promise<void>(resolve => {
grandChildrenProcessor = async () => {
grandChildrenProcessor = async job => {
processedGrandChildren++;

await delay(job.data.delay);

if (processedGrandChildren === 2) {
return resolve();
}

await delay(200);

throw new Error('failed');
};
});
Expand Down Expand Up @@ -2169,13 +2169,13 @@ describe('flows', () => {
children: [
{
name,
data: { foo: 'bar' },
data: { foo: 'bar', delay: 200 },
queueName: grandChildrenQueueName,
opts: { failParentOnFailure: true },
},
{
name,
data: { foo: 'baz' },
data: { foo: 'baz', delay: 2500 },
queueName: grandChildrenQueueName,
},
],
Expand All @@ -2186,6 +2186,12 @@ describe('flows', () => {
const failed = new Promise<void>(resolve => {
queueEvents.on('failed', async ({ jobId, failedReason, prev }) => {
if (jobId === tree.job.id) {
await delay(200);
const grandChildState = await grandChildrenQueue.getJobState(
tree.children![1].children![1].job.id!,
);
expect(grandChildState).to.be.equal('active');

expect(prev).to.be.equal('waiting-children');
expect(failedReason).to.be.equal(
`child ${prefix}:${queueName}:${tree.children[1].job.id} failed`,
Expand Down