Skip to content

Commit a1f2ec2

Browse files
authored
chore(scheduler-targets): lambda invoke target integration test (#27088)
Continuing @Jacco work from #26268 Currently we were second-guessing if the implementations of ScheduleExpression and ScheduleTargetInput generate valid and correct CloudFormation. This integration test verifies that lambda invoke target is invoked: - A schedule is deployed that triggers a Lambda every minute after deployment. - The function adds a Tag to itself Key=OutputValue Value=base64 of the JSON string made of the input event - An assertion is made that checks for 10 minutes if the expected Tag appears Advances #23394 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 20e4760 commit a1f2ec2

File tree

14 files changed

+34182
-1
lines changed

14 files changed

+34182
-1
lines changed

packages/@aws-cdk/aws-scheduler-targets-alpha/lib/lambda-invoke.ts

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import * as lambda from 'aws-cdk-lib/aws-lambda';
55
import { ScheduleTargetBase, ScheduleTargetBaseProps } from './target';
66
import { sameEnvDimension } from './util';
77

8+
/**
9+
* Use an AWS Lambda function as a target for AWS EventBridge Scheduler.
10+
*/
811
export class LambdaInvoke extends ScheduleTargetBase implements IScheduleTarget {
912
constructor(
1013
private readonly func: lambda.IFunction,

packages/@aws-cdk/aws-scheduler-targets-alpha/lib/target.ts

+8
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ export interface ScheduleTargetBaseProps {
6262
readonly retryAttempts?: number;
6363
}
6464

65+
/**
66+
* Base class for Schedule Targets
67+
*/
6568
export abstract class ScheduleTargetBase {
6669

6770
constructor(
@@ -91,6 +94,11 @@ export abstract class ScheduleTargetBase {
9194
};
9295
}
9396

97+
/**
98+
* Create a return a Schedule Target Configuration for the given schedule
99+
* @param schedule
100+
* @returnn
101+
*/
94102
bind(schedule: ISchedule): ScheduleTargetConfig {
95103
return this.bindBaseTargetConfig(schedule);
96104
}

packages/@aws-cdk/aws-scheduler-targets-alpha/package.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@
8888
"@types/jest": "^29.5.5",
8989
"aws-cdk-lib": "0.0.0",
9090
"@aws-cdk/aws-scheduler-alpha": "0.0.0",
91-
"constructs": "^10.0.0"
91+
"constructs": "^10.0.0",
92+
"@aws-cdk/integ-tests-alpha": "0.0.0"
9293
},
9394
"dependencies": {},
9495
"peerDependencies": {

0 commit comments

Comments
 (0)