Skip to content

Commit

Permalink
feat(test): Add unit test for scan function timeout.
Browse files Browse the repository at this point in the history
  • Loading branch information
bdmartin committed Dec 3, 2024
1 parent a6b3370 commit 470df83
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion test/ServerlessClamscan.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { ABSENT, anything, arrayWith, objectLike, stringLike } from '@aws-cdk/assert';
import { Size, Stack } from 'aws-cdk-lib';
import { Duration, Size, Stack } from 'aws-cdk-lib';
import { PerformanceMode, ThroughputMode } from 'aws-cdk-lib/aws-efs';
import { EventBus } from 'aws-cdk-lib/aws-events';
import { SqsDestination, EventBridgeDestination } from 'aws-cdk-lib/aws-lambda-destinations';
Expand Down Expand Up @@ -959,3 +959,20 @@ test('expect EFS throughput mode to be set as configured', () => {
ThroughputMode: 'provisioned',
});
});

test('expect scan function timeout default to be 15 minutes', () => {
const stack = new Stack();
new ServerlessClamscan(stack, 'default', {});
expect(stack).toHaveResourceLike('AWS::Lambda::Function', {
Timeout: 900,
});
});

test('expect scan function timeout to be set as configured', () => {
const stack = new Stack();
new ServerlessClamscan(stack, 'default', { scanFunctionTimeout: Duration.minutes(5) });
expect(stack).toHaveResourceLike('AWS::Lambda::Function', {
Timeout: 300,
});
});

0 comments on commit 470df83

Please sign in to comment.