From 557fe800a7cae45b302a7948a50693a52df2e897 Mon Sep 17 00:00:00 2001 From: Samson Keung Date: Thu, 17 Oct 2024 15:42:14 -0700 Subject: [PATCH] remove targetOverrides prop from Schedule --- .../aws-scheduler-alpha/lib/schedule.ts | 50 +------ .../aws-scheduler-alpha/test/input.test.ts | 20 --- .../aws-cdk-scheduler-schedule.assets.json | 6 +- .../aws-cdk-scheduler-schedule.template.json | 38 +---- .../test/integ.schedule.js.snapshot/cdk.out | 2 +- .../integ.schedule.js.snapshot/integ.json | 2 +- ...efaultTestDeployAssert24CB3896.assets.json | 2 +- .../integ.schedule.js.snapshot/manifest.json | 21 ++- .../test/integ.schedule.js.snapshot/tree.json | 68 ++------- .../test/integ.schedule.ts | 13 +- .../test/retry-policy.test.ts | 138 ------------------ 11 files changed, 39 insertions(+), 321 deletions(-) delete mode 100644 packages/@aws-cdk/aws-scheduler-alpha/test/retry-policy.test.ts diff --git a/packages/@aws-cdk/aws-scheduler-alpha/lib/schedule.ts b/packages/@aws-cdk/aws-scheduler-alpha/lib/schedule.ts index 1d3774d432ed0..61183eab478e5 100644 --- a/packages/@aws-cdk/aws-scheduler-alpha/lib/schedule.ts +++ b/packages/@aws-cdk/aws-scheduler-alpha/lib/schedule.ts @@ -4,7 +4,6 @@ import * as kms from 'aws-cdk-lib/aws-kms'; import { CfnSchedule } from 'aws-cdk-lib/aws-scheduler'; import { Construct } from 'constructs'; import { IGroup } from './group'; -import { ScheduleTargetInput } from './input'; import { ScheduleExpression } from './schedule-expression'; import { IScheduleTarget } from './target'; @@ -26,37 +25,6 @@ export interface ISchedule extends IResource { * The arn of the schedule. */ readonly scheduleArn: string; - - /** - * The customer managed KMS key that EventBridge Scheduler will use to encrypt and decrypt your data. - */ - readonly key?: kms.IKey; -} - -export interface ScheduleTargetProps { - /** - * The text, or well-formed JSON, passed to the target. - * - * If you are configuring a templated Lambda, AWS Step Functions, or Amazon EventBridge target, - * the input must be a well-formed JSON. For all other target types, a JSON is not required. - * - * @default - The target's input is used. - */ - readonly input?: ScheduleTargetInput; - - /** - * The maximum amount of time, in seconds, to continue to make retry attempts. - * - * @default - The target's maximumEventAgeInSeconds is used. - */ - readonly maxEventAge?: Duration; - - /** - * The maximum number of retry attempts to make before the request fails. - * - * @default - The target's maximumRetryAttempts is used. - */ - readonly retryAttempts?: number; } /** @@ -115,11 +83,6 @@ export interface ScheduleProps { */ readonly target: IScheduleTarget; - /** - * Allows to override target properties when creating a new schedule. - */ - readonly targetOverrides?: ScheduleTargetProps; - /** * The name of the schedule. * @@ -342,11 +305,9 @@ export class Schedule extends Resource implements ISchedule { target: { arn: targetConfig.arn, roleArn: targetConfig.role.roleArn, - input: props.targetOverrides?.input ? - props.targetOverrides?.input?.bind(this) : - targetConfig.input?.bind(this), + input: targetConfig.input?.bind(this), deadLetterConfig: targetConfig.deadLetterConfig, - retryPolicy: this.renderRetryPolicy(props.targetOverrides?.maxEventAge?.toSeconds(), props.targetOverrides?.retryAttempts), + retryPolicy: this.renderRetryPolicy(), ecsParameters: targetConfig.ecsParameters, kinesisParameters: targetConfig.kinesisParameters, eventBridgeParameters: targetConfig.eventBridgeParameters, @@ -366,14 +327,9 @@ export class Schedule extends Resource implements ISchedule { }); } - private renderRetryPolicy( - maximumEventAgeInSeconds?: number, - maximumRetryAttempts?: number, - ): CfnSchedule.RetryPolicyProperty | undefined { + private renderRetryPolicy(): CfnSchedule.RetryPolicyProperty | undefined { const policy = { ...this.retryPolicy, - maximumEventAgeInSeconds: maximumEventAgeInSeconds ?? this.retryPolicy?.maximumEventAgeInSeconds, - maximumRetryAttempts: maximumRetryAttempts ?? this.retryPolicy?.maximumRetryAttempts, }; if (policy.maximumEventAgeInSeconds && (policy.maximumEventAgeInSeconds < 60 || policy.maximumEventAgeInSeconds > 86400)) { diff --git a/packages/@aws-cdk/aws-scheduler-alpha/test/input.test.ts b/packages/@aws-cdk/aws-scheduler-alpha/test/input.test.ts index 07aa43853e182..afb890b7957ec 100644 --- a/packages/@aws-cdk/aws-scheduler-alpha/test/input.test.ts +++ b/packages/@aws-cdk/aws-scheduler-alpha/test/input.test.ts @@ -146,24 +146,4 @@ describe('schedule target input', () => { }, }); }); - - test('can override target input', () => { - // WHEN - const input = ScheduleTargetInput.fromText('Original Input'); - new Schedule(stack, 'TestSchedule', { - schedule: expr, - target: new SomeLambdaTarget(func, input), - targetOverrides: { - input: ScheduleTargetInput.fromText('Overridden Input'), - }, - enabled: false, - }); - - // THEN - Template.fromStack(stack).hasResourceProperties('AWS::Scheduler::Schedule', { - Target: { - Input: '"Overridden Input"', - }, - }); - }); }); diff --git a/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.js.snapshot/aws-cdk-scheduler-schedule.assets.json b/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.js.snapshot/aws-cdk-scheduler-schedule.assets.json index 16f3bc2b8416d..dc98db43f2851 100644 --- a/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.js.snapshot/aws-cdk-scheduler-schedule.assets.json +++ b/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.js.snapshot/aws-cdk-scheduler-schedule.assets.json @@ -1,7 +1,7 @@ { - "version": "36.0.5", + "version": "38.0.1", "files": { - "82ee1f337089b876e0369c9cb4ede655c9e7f6fd0ed60bef9a01c85dd68df90b": { + "5a43a269a52dd0de66d069f65579eb66b8834ff191e42c05d09a9a5cdfb5a252": { "source": { "path": "aws-cdk-scheduler-schedule.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "82ee1f337089b876e0369c9cb4ede655c9e7f6fd0ed60bef9a01c85dd68df90b.json", + "objectKey": "5a43a269a52dd0de66d069f65579eb66b8834ff191e42c05d09a9a5cdfb5a252.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.js.snapshot/aws-cdk-scheduler-schedule.template.json b/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.js.snapshot/aws-cdk-scheduler-schedule.template.json index eb3c82999de54..d6a8121a8550a 100644 --- a/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.js.snapshot/aws-cdk-scheduler-schedule.template.json +++ b/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.js.snapshot/aws-cdk-scheduler-schedule.template.json @@ -103,16 +103,16 @@ "Properties": { "Name": "TestGroup" }, - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" }, "UnnamedGroupBE3E48EE": { "Type": "AWS::Scheduler::ScheduleGroup", "Properties": { "Name": "awscdkschedulerschedule-UnnamedGroup-97DBE50D" }, - "UpdateReplacePolicy": "Retain", - "DeletionPolicy": "Retain" + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" }, "DefaultSchedule597B0B2C": { "Type": "AWS::Scheduler::Schedule", @@ -236,36 +236,6 @@ } } }, - "TargetOverrideScheduleFF8CB184": { - "Type": "AWS::Scheduler::Schedule", - "Properties": { - "FlexibleTimeWindow": { - "Mode": "OFF" - }, - "ScheduleExpression": "rate(12 hours)", - "ScheduleExpressionTimezone": "Etc/UTC", - "State": "ENABLED", - "Target": { - "Arn": { - "Fn::GetAtt": [ - "Function76856677", - "Arn" - ] - }, - "Input": "\"Changed Text\"", - "RetryPolicy": { - "MaximumEventAgeInSeconds": 360, - "MaximumRetryAttempts": 5 - }, - "RoleArn": { - "Fn::GetAtt": [ - "Role1ABCC5F0", - "Arn" - ] - } - } - } - }, "AllSchedulerErrorsAlarmA3246F8C": { "Type": "AWS::CloudWatch::Alarm", "Properties": { diff --git a/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.js.snapshot/cdk.out b/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.js.snapshot/cdk.out index bd5311dc372de..c6e612584e352 100644 --- a/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.js.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.5"} \ No newline at end of file +{"version":"38.0.1"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.js.snapshot/integ.json b/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.js.snapshot/integ.json index 0bbaf1242f147..fb27279537848 100644 --- a/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.js.snapshot/integ.json +++ b/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.5", + "version": "38.0.1", "testCases": { "integtest-schedule/DefaultTest": { "stacks": [ diff --git a/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.js.snapshot/integtestscheduleDefaultTestDeployAssert24CB3896.assets.json b/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.js.snapshot/integtestscheduleDefaultTestDeployAssert24CB3896.assets.json index 22605eadd7879..079feb6038fbf 100644 --- a/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.js.snapshot/integtestscheduleDefaultTestDeployAssert24CB3896.assets.json +++ b/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.js.snapshot/integtestscheduleDefaultTestDeployAssert24CB3896.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.5", + "version": "38.0.1", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.js.snapshot/manifest.json b/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.js.snapshot/manifest.json index 33e771dc83d1c..f8bc7ce39f5a3 100644 --- a/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.js.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.5", + "version": "38.0.1", "artifacts": { "aws-cdk-scheduler-schedule.assets": { "type": "cdk:asset-manifest", @@ -16,9 +16,10 @@ "templateFile": "aws-cdk-scheduler-schedule.template.json", "terminationProtection": false, "validateOnSynth": false, + "notificationArns": [], "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/82ee1f337089b876e0369c9cb4ede655c9e7f6fd0ed60bef9a01c85dd68df90b.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/5a43a269a52dd0de66d069f65579eb66b8834ff191e42c05d09a9a5cdfb5a252.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -94,12 +95,6 @@ "data": "DisabledScheduleA1DF7F0F" } ], - "/aws-cdk-scheduler-schedule/TargetOverrideSchedule/Resource": [ - { - "type": "aws:cdk:logicalId", - "data": "TargetOverrideScheduleFF8CB184" - } - ], "/aws-cdk-scheduler-schedule/AllSchedulerErrorsAlarm/Resource": [ { "type": "aws:cdk:logicalId", @@ -147,6 +142,15 @@ "type": "aws:cdk:logicalId", "data": "CheckBootstrapVersion" } + ], + "TargetOverrideScheduleFF8CB184": [ + { + "type": "aws:cdk:logicalId", + "data": "TargetOverrideScheduleFF8CB184", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } ] }, "displayName": "aws-cdk-scheduler-schedule" @@ -166,6 +170,7 @@ "templateFile": "integtestscheduleDefaultTestDeployAssert24CB3896.template.json", "terminationProtection": false, "validateOnSynth": false, + "notificationArns": [], "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", diff --git a/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.js.snapshot/tree.json b/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.js.snapshot/tree.json index a345a34306cc4..a8c9ecfa70879 100644 --- a/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.js.snapshot/tree.json +++ b/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.js.snapshot/tree.json @@ -211,7 +211,7 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.Resource", + "fqn": "@aws-cdk/aws-scheduler-alpha.Group", "version": "0.0.0" } }, @@ -235,7 +235,7 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.Resource", + "fqn": "@aws-cdk/aws-scheduler-alpha.Group", "version": "0.0.0" } }, @@ -283,7 +283,7 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.Resource", + "fqn": "@aws-cdk/aws-scheduler-alpha.Schedule", "version": "0.0.0" } }, @@ -332,7 +332,7 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.Resource", + "fqn": "@aws-cdk/aws-scheduler-alpha.Schedule", "version": "0.0.0" } }, @@ -381,7 +381,7 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.Resource", + "fqn": "@aws-cdk/aws-scheduler-alpha.Schedule", "version": "0.0.0" } }, @@ -429,55 +429,7 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.Resource", - "version": "0.0.0" - } - }, - "TargetOverrideSchedule": { - "id": "TargetOverrideSchedule", - "path": "aws-cdk-scheduler-schedule/TargetOverrideSchedule", - "children": { - "Resource": { - "id": "Resource", - "path": "aws-cdk-scheduler-schedule/TargetOverrideSchedule/Resource", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Scheduler::Schedule", - "aws:cdk:cloudformation:props": { - "flexibleTimeWindow": { - "mode": "OFF" - }, - "scheduleExpression": "rate(12 hours)", - "scheduleExpressionTimezone": "Etc/UTC", - "state": "ENABLED", - "target": { - "arn": { - "Fn::GetAtt": [ - "Function76856677", - "Arn" - ] - }, - "roleArn": { - "Fn::GetAtt": [ - "Role1ABCC5F0", - "Arn" - ] - }, - "input": "\"Changed Text\"", - "retryPolicy": { - "maximumEventAgeInSeconds": 360, - "maximumRetryAttempts": 5 - } - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_scheduler.CfnSchedule", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.Resource", + "fqn": "@aws-cdk/aws-scheduler-alpha.Schedule", "version": "0.0.0" } }, @@ -612,7 +564,7 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.Resource", + "fqn": "@aws-cdk/aws-scheduler-alpha.Schedule", "version": "0.0.0" } }, @@ -661,7 +613,7 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.Resource", + "fqn": "@aws-cdk/aws-scheduler-alpha.Schedule", "version": "0.0.0" } }, @@ -711,7 +663,7 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.Resource", + "fqn": "@aws-cdk/aws-scheduler-alpha.Schedule", "version": "0.0.0" } }, @@ -760,7 +712,7 @@ } }, "constructInfo": { - "fqn": "aws-cdk-lib.Resource", + "fqn": "@aws-cdk/aws-scheduler-alpha.Schedule", "version": "0.0.0" } }, diff --git a/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.ts b/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.ts index 46c08955756c4..b28d7d55924c3 100644 --- a/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.ts +++ b/packages/@aws-cdk/aws-scheduler-alpha/test/integ.schedule.ts @@ -42,7 +42,10 @@ const target = new SomeLambdaTarget(func, role); const namedGroup = new scheduler.Group(stack, 'NamedGroup', { groupName: 'TestGroup', }); +namedGroup.applyRemovalPolicy(cdk.RemovalPolicy.DESTROY); + const unnamedGroup = new scheduler.Group(stack, 'UnnamedGroup', {}); +unnamedGroup.applyRemovalPolicy(cdk.RemovalPolicy.DESTROY); new scheduler.Schedule(stack, 'DefaultSchedule', { schedule: expression, @@ -67,16 +70,6 @@ new scheduler.Schedule(stack, 'DisabledSchedule', { enabled: false, }); -new scheduler.Schedule(stack, 'TargetOverrideSchedule', { - schedule: expression, - target: target, - targetOverrides: { - input: scheduler.ScheduleTargetInput.fromText('Changed Text'), - maxEventAge: cdk.Duration.seconds(360), - retryAttempts: 5, - }, -}); - new cloudwatch.Alarm(stack, 'AllSchedulerErrorsAlarm', { metric: scheduler.Schedule.metricAllErrors(), threshold: 1, diff --git a/packages/@aws-cdk/aws-scheduler-alpha/test/retry-policy.test.ts b/packages/@aws-cdk/aws-scheduler-alpha/test/retry-policy.test.ts deleted file mode 100644 index 99b462169a64b..0000000000000 --- a/packages/@aws-cdk/aws-scheduler-alpha/test/retry-policy.test.ts +++ /dev/null @@ -1,138 +0,0 @@ -import { App, Duration, Stack } from 'aws-cdk-lib'; - -import { Template } from 'aws-cdk-lib/assertions'; -import * as iam from 'aws-cdk-lib/aws-iam'; -import * as lambda from 'aws-cdk-lib/aws-lambda'; -import { IScheduleTarget, ScheduleExpression, ScheduleTargetConfig } from '../lib'; -import { Schedule } from '../lib/schedule'; - -class SomeLambdaTarget implements IScheduleTarget { - public constructor(private readonly fn: lambda.IFunction) { - } - - public bind(): ScheduleTargetConfig { - return { - arn: this.fn.functionArn, - retryPolicy: { - maximumEventAgeInSeconds: 180, - maximumRetryAttempts: 10, - }, - role: iam.Role.fromRoleArn(this.fn, 'ImportedRole', 'arn:aws:iam::123456789012:role/someRole'), - }; - } -} - -describe('schedule target retry policy', () => { - let stack: Stack; - let func: lambda.IFunction; - const expr = ScheduleExpression.at(new Date(Date.UTC(1969, 10, 20, 0, 0, 0))); - - beforeEach(() => { - const app = new App(); - stack = new Stack(app); - func = new lambda.Function(stack, 'MyLambda', { - code: new lambda.InlineCode('foo'), - handler: 'index.handler', - runtime: lambda.Runtime.NODEJS_LATEST, - tracing: lambda.Tracing.PASS_THROUGH, - }); - }); - - test('create a schedule with retry policy', () => { - new Schedule(stack, 'MyScheduleDummy', { - schedule: expr, - target: new SomeLambdaTarget(func), - }); - Template.fromStack(stack).hasResource('AWS::Scheduler::Schedule', { - Properties: { - Target: { - RetryPolicy: { - MaximumEventAgeInSeconds: 180, - MaximumRetryAttempts: 10, - }, - }, - }, - }); - }); - - test('can override retry policy', () => { - // WHEN - new Schedule(stack, 'TestSchedule', { - schedule: expr, - target: new SomeLambdaTarget(func), - targetOverrides: { - maxEventAge: Duration.seconds(120), - retryAttempts: 5, - }, - enabled: false, - }); - - // THEN - Template.fromStack(stack).hasResource('AWS::Scheduler::Schedule', { - Properties: { - Target: { - RetryPolicy: { - MaximumEventAgeInSeconds: 120, - MaximumRetryAttempts: 5, - }, - }, - }, - }); - }); - - test('apply maximumEventAge min value validation', () => { - expect(() => { - new Schedule(stack, 'TestSchedule', { - schedule: expr, - target: new SomeLambdaTarget(func), - targetOverrides: { - maxEventAge: Duration.seconds(50), - retryAttempts: 5, - }, - enabled: false, - }); - }).toThrow(/maximumEventAgeInSeconds must be between 60 and 86400, got 50/); - }); - - test('apply maximumEventAge max value validation', () => { - expect(() => { - new Schedule(stack, 'TestSchedule', { - schedule: expr, - target: new SomeLambdaTarget(func), - targetOverrides: { - maxEventAge: Duration.seconds(100000), - retryAttempts: 5, - }, - enabled: false, - }); - }).toThrow(/maximumEventAgeInSeconds must be between 60 and 86400, got 100000/); - }); - - test('apply maximumRetryAttempts min value validation', () => { - expect(() => { - new Schedule(stack, 'TestSchedule', { - schedule: expr, - target: new SomeLambdaTarget(func), - targetOverrides: { - maxEventAge: Duration.seconds(120), - retryAttempts: -1, - }, - enabled: false, - }); - }).toThrow(/maximumRetryAttempts must be between 0 and 185, got -1/); - }); - - test('apply maximumRetryAttempts max value validation', () => { - expect(() => { - new Schedule(stack, 'TestSchedule', { - schedule: expr, - target: new SomeLambdaTarget(func), - targetOverrides: { - maxEventAge: Duration.seconds(120), - retryAttempts: 200, - }, - enabled: false, - }); - }).toThrow(/maximumRetryAttempts must be between 0 and 185, got 200/); - }); -});