Skip to content

Commit

Permalink
Merge branch 'offload-manual-executions-to-workers' into pay-2403-red…
Browse files Browse the repository at this point in the history
…uce-large-relay-message-payloads-to-protect-redis
  • Loading branch information
ivov committed Dec 23, 2024
2 parents 908e5ff + e0e2a17 commit f2bc54a
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ describe('ExecutionService', () => {

describe('scaling mode', () => {
describe('manual execution', () => {
it('should delegate to regular mode in scaling mode', async () => {
it('should stop a `running` execution in scaling mode', async () => {
/**
* Arrange
*/
Expand All @@ -197,6 +197,8 @@ describe('ExecutionService', () => {
concurrencyControl.has.mockReturnValue(false);
activeExecutions.has.mockReturnValue(true);
waitTracker.has.mockReturnValue(false);
const job = mock<Job>({ data: { executionId: '123' } });
scalingService.findJobsByStatus.mockResolvedValue([job]);
executionRepository.stopDuringRun.mockResolvedValue(mock<IExecutionResponse>());
// @ts-expect-error Private method
const stopInRegularModeSpy = jest.spyOn(executionService, 'stopInRegularMode');
Expand All @@ -209,13 +211,13 @@ describe('ExecutionService', () => {
/**
* Assert
*/
expect(stopInRegularModeSpy).toHaveBeenCalledWith(execution);
expect(stopInRegularModeSpy).not.toHaveBeenCalled();
expect(activeExecutions.stopExecution).toHaveBeenCalledWith(execution.id);
expect(executionRepository.stopDuringRun).toHaveBeenCalledWith(execution);

expect(concurrencyControl.remove).not.toHaveBeenCalled();
expect(waitTracker.stopExecution).not.toHaveBeenCalled();
expect(scalingService.stopJob).not.toHaveBeenCalled();
expect(scalingService.stopJob).toHaveBeenCalled();
});
});

Expand Down

0 comments on commit f2bc54a

Please sign in to comment.