Skip to content

Commit

Permalink
fixed validation for maximumEventAgeInSeconds
Browse files Browse the repository at this point in the history
  • Loading branch information
lpizzinidev committed Oct 19, 2023
1 parent 51ab22e commit ede8e75
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-scheduler-alpha/lib/schedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ export class Schedule extends Resource implements ISchedule {
}

private validateRetryPolicy(maximumEventAgeInSeconds: number | undefined, maximumRetryAttempts: number | undefined) {
if (maximumEventAgeInSeconds && (maximumEventAgeInSeconds < 60 || maximumEventAgeInSeconds > 900)) {
throw new Error(`maximumEventAgeInSeconds must be between 60 and 900, got ${maximumEventAgeInSeconds}`);
if (maximumEventAgeInSeconds && (maximumEventAgeInSeconds < 60 || maximumEventAgeInSeconds > 86400)) {
throw new Error(`maximumEventAgeInSeconds must be between 60 and 86400, got ${maximumEventAgeInSeconds}`);
}
if (maximumRetryAttempts && (maximumRetryAttempts < 0 || maximumRetryAttempts > 185)) {
throw new Error(`maximumRetryAttempts must be between 0 and 185, got ${maximumRetryAttempts}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describe('schedule target retry policy', () => {
},
enabled: false,
});
}).toThrow(/maximumEventAgeInSeconds must be between 60 and 900, got 50/);
}).toThrow(/maximumEventAgeInSeconds must be between 60 and 86400, got 50/);
});

test('apply maximumEventAge max value validation', () => {
Expand All @@ -100,12 +100,12 @@ describe('schedule target retry policy', () => {
schedule: expr,
target: new SomeLambdaTarget(func),
targetOverrides: {
maximumEventAge: Duration.seconds(1000),
maximumEventAge: Duration.seconds(100000),
maximumRetryAttempts: 5,
},
enabled: false,
});
}).toThrow(/maximumEventAgeInSeconds must be between 60 and 900, got 1000/);
}).toThrow(/maximumEventAgeInSeconds must be between 60 and 86400, got 100000/);
});

test('apply maximumRetryAttempts min value validation', () => {
Expand Down

0 comments on commit ede8e75

Please sign in to comment.