-
Notifications
You must be signed in to change notification settings - Fork 8.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): Ensure job processor does not reprocess amended executions (…
- Loading branch information
Showing
3 changed files
with
28 additions
and
12 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
packages/cli/src/scaling/__tests__/job-processor.service.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { mock } from 'jest-mock-extended'; | ||
|
||
import type { ExecutionRepository } from '@/databases/repositories/execution.repository'; | ||
import type { IExecutionResponse } from '@/interfaces'; | ||
|
||
import { JobProcessor } from '../job-processor'; | ||
import type { Job } from '../scaling.types'; | ||
|
||
describe('JobProcessor', () => { | ||
it('should refrain from processing a crashed execution', async () => { | ||
const executionRepository = mock<ExecutionRepository>(); | ||
executionRepository.findSingleExecution.mockResolvedValue( | ||
mock<IExecutionResponse>({ status: 'crashed' }), | ||
); | ||
const jobProcessor = new JobProcessor(mock(), executionRepository, mock(), mock(), mock()); | ||
|
||
const result = await jobProcessor.processJob(mock<Job>()); | ||
|
||
expect(result).toEqual({ success: false }); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters