Skip to content

Commit

Permalink
Merge branch 'master' into revert-s3-eventbridge
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Jan 19, 2022
2 parents 4785719 + 517d517 commit 348d4ca
Show file tree
Hide file tree
Showing 92 changed files with 1,577 additions and 1,137 deletions.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-acmpca/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert-internal": "0.0.0",
"@aws-cdk/assertions": "0.0.0",
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/cfn2ts": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
Expand Down
1 change: 0 additions & 1 deletion packages/@aws-cdk/aws-acmpca/test/acmpca.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import '@aws-cdk/assert-internal/jest';
import {} from '../lib';

test('No tests are specified for this package', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-applicationautoscaling/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert-internal": "0.0.0",
"@aws-cdk/assertions": "0.0.0",
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/cfn2ts": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import '@aws-cdk/assert-internal/jest';
import { Match, Template } from '@aws-cdk/assertions';
import * as cloudwatch from '@aws-cdk/aws-cloudwatch';
import * as iam from '@aws-cdk/aws-iam';
import * as cdk from '@aws-cdk/core';
Expand All @@ -20,7 +20,7 @@ describe('scalable target', () => {
});

// THEN
expect(stack).toHaveResource('AWS::ApplicationAutoScaling::ScalableTarget', {
Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalableTarget', {
ServiceNamespace: 'dynamodb',
ScalableDimension: 'test:TestCount',
ResourceId: 'test:this/test',
Expand All @@ -43,7 +43,7 @@ describe('scalable target', () => {
});

// THEN: no exception
expect(stack).toHaveResource('AWS::ApplicationAutoScaling::ScalableTarget', {
Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalableTarget', {
ServiceNamespace: 'dynamodb',
ScalableDimension: 'test:TestCount',
ResourceId: 'test:this/test',
Expand All @@ -65,7 +65,7 @@ describe('scalable target', () => {
});

// THEN
expect(stack).toHaveResource('AWS::ApplicationAutoScaling::ScalableTarget', {
Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalableTarget', {
ScheduledActions: [
{
ScalableTargetAction: {
Expand Down Expand Up @@ -104,11 +104,11 @@ describe('scalable target', () => {
});

// THEN
expect(stack).not.toHaveResource('AWS::CloudWatch::Alarm', {
Template.fromStack(stack).hasResourceProperties('AWS::CloudWatch::Alarm', Match.not({
Period: 60,
});
}));

expect(stack).toHaveResource('AWS::CloudWatch::Alarm', {
Template.fromStack(stack).hasResourceProperties('AWS::CloudWatch::Alarm', {
ComparisonOperator: 'LessThanOrEqualToThreshold',
EvaluationPeriods: 1,
Metrics: [
Expand Down Expand Up @@ -203,7 +203,7 @@ describe('scalable target', () => {
});

// THEN
expect(stack).toHaveResource('AWS::ApplicationAutoScaling::ScalableTarget', {
Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalableTarget', {
ServiceNamespace: 'dynamodb',
ScalableDimension: 'test:TestCount',
ResourceId: 'test:this/test',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import '@aws-cdk/assert-internal/jest';
import { SynthUtils } from '@aws-cdk/assert-internal';
import { Template } from '@aws-cdk/assertions';
import * as cloudwatch from '@aws-cdk/aws-cloudwatch';
import * as cdk from '@aws-cdk/core';
import * as fc from 'fast-check';
Expand Down Expand Up @@ -132,7 +131,7 @@ describe('step scaling policy', () => {
});

// THEN
expect(stack).toHaveResource('AWS::ApplicationAutoScaling::ScalingPolicy', {
Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalingPolicy', {
PolicyType: 'StepScaling',
ScalingTargetId: {
Ref: 'Target3191CF44',
Expand Down Expand Up @@ -169,14 +168,14 @@ describe('step scaling policy', () => {
});

// THEN
expect(stack).toHaveResourceLike('AWS::ApplicationAutoScaling::ScalingPolicy', {
Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalingPolicy', {
PolicyType: 'StepScaling',
StepScalingPolicyConfiguration: {
AdjustmentType: 'ChangeInCapacity',
MetricAggregationType: 'Average',
},
});
expect(stack).toHaveResource('AWS::CloudWatch::Alarm', {
Template.fromStack(stack).hasResourceProperties('AWS::CloudWatch::Alarm', {
ComparisonOperator: 'GreaterThanOrEqualToThreshold',
EvaluationPeriods: 1,
AlarmActions: [
Expand Down Expand Up @@ -209,14 +208,14 @@ describe('step scaling policy', () => {
});

// THEN
expect(stack).toHaveResourceLike('AWS::ApplicationAutoScaling::ScalingPolicy', {
Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalingPolicy', {
PolicyType: 'StepScaling',
StepScalingPolicyConfiguration: {
AdjustmentType: 'ChangeInCapacity',
MetricAggregationType: 'Maximum',
},
});
expect(stack).toHaveResource('AWS::CloudWatch::Alarm', {
Template.fromStack(stack).hasResourceProperties('AWS::CloudWatch::Alarm', {
ComparisonOperator: 'GreaterThanOrEqualToThreshold',
EvaluationPeriods: 10,
ExtendedStatistic: 'p99',
Expand Down Expand Up @@ -247,14 +246,14 @@ describe('step scaling policy', () => {
});

// THEN
expect(stack).toHaveResourceLike('AWS::ApplicationAutoScaling::ScalingPolicy', {
Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalingPolicy', {
PolicyType: 'StepScaling',
StepScalingPolicyConfiguration: {
AdjustmentType: 'ChangeInCapacity',
MetricAggregationType: 'Maximum',
},
});
expect(stack).toHaveResource('AWS::CloudWatch::Alarm', {
Template.fromStack(stack).hasResourceProperties('AWS::CloudWatch::Alarm', {
ComparisonOperator: 'GreaterThanOrEqualToThreshold',
EvaluationPeriods: 10,
DatapointsToAlarm: 6,
Expand Down Expand Up @@ -297,7 +296,7 @@ function setupStepScaling(intervals: appscaling.ScalingInterval[]) {
scalingSteps: intervals,
});

return new ScalingStackTemplate(SynthUtils.synthesize(stack).template);
return new ScalingStackTemplate(Template.fromStack(stack).toJSON());
}

class ScalingStackTemplate {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import '@aws-cdk/assert-internal/jest';
import { Template } from '@aws-cdk/assertions';
import * as cloudwatch from '@aws-cdk/aws-cloudwatch';
import * as cdk from '@aws-cdk/core';
import * as appscaling from '../lib';
Expand All @@ -17,7 +17,7 @@ describe('target tracking', () => {
});

// THEN
expect(stack).toHaveResource('AWS::ApplicationAutoScaling::ScalingPolicy', {
Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalingPolicy', {
PolicyType: 'TargetTrackingScaling',
TargetTrackingScalingPolicyConfiguration: {
PredefinedMetricSpecification: { PredefinedMetricType: 'EC2SpotFleetRequestAverageCPUUtilization' },
Expand All @@ -41,7 +41,7 @@ describe('target tracking', () => {
});

// THEN
expect(stack).toHaveResource('AWS::ApplicationAutoScaling::ScalingPolicy', {
Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalingPolicy', {
PolicyType: 'TargetTrackingScaling',
TargetTrackingScalingPolicyConfiguration: {
PredefinedMetricSpecification: { PredefinedMetricType: 'LambdaProvisionedConcurrencyUtilization' },
Expand All @@ -65,7 +65,7 @@ describe('target tracking', () => {
});

// THEN
expect(stack).toHaveResourceLike('AWS::ApplicationAutoScaling::ScalingPolicy', {
Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalingPolicy', {
TargetTrackingScalingPolicyConfiguration: {
PredefinedMetricSpecification: { PredefinedMetricType: 'DynamoDBWriteCapacityUtilization' },
TargetValue: 0.9,
Expand All @@ -85,7 +85,7 @@ describe('target tracking', () => {
});

// THEN
expect(stack).toHaveResource('AWS::ApplicationAutoScaling::ScalingPolicy', {
Template.fromStack(stack).hasResourceProperties('AWS::ApplicationAutoScaling::ScalingPolicy', {
PolicyType: 'TargetTrackingScaling',
TargetTrackingScalingPolicyConfiguration: {
CustomizedMetricSpecification: {
Expand Down
1 change: 0 additions & 1 deletion packages/@aws-cdk/aws-apprunner/test/service.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as path from 'path';
import '@aws-cdk/assert-internal/jest';
import { Template } from '@aws-cdk/assertions';
import * as ecr from '@aws-cdk/aws-ecr';
import * as ecr_assets from '@aws-cdk/aws-ecr-assets';
Expand Down
1 change: 0 additions & 1 deletion packages/@aws-cdk/aws-autoscaling-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert-internal": "0.0.0",
"@aws-cdk/cdk-build-tools": "0.0.0",
"@aws-cdk/cdk-integ-tools": "0.0.0",
"@aws-cdk/pkglint": "0.0.0",
Expand Down
16 changes: 0 additions & 16 deletions packages/@aws-cdk/aws-autoscaling-common/test/intervals.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ describe('intervals', () => {
{ lower: 80, upper: 90, change: +1 },
{ lower: 90, upper: Infinity, change: +2 },
]);


});

test('test interval completion', () => {
Expand All @@ -37,8 +35,6 @@ describe('intervals', () => {
{ lower: 65, upper: 85, change: +3 },
{ lower: 85, upper: Infinity, change: undefined },
]);


});

test('bounds propagation fails if middle boundary missing', () => {
Expand All @@ -48,8 +44,6 @@ describe('intervals', () => {
{ upper: 20, change: -1 },
], false);
}).toThrow();


});

test('lower alarm index is lower than higher alarm index', () => {
Expand All @@ -63,8 +57,6 @@ describe('intervals', () => {
|| alarms.lowerAlarmIntervalIndex < alarms.upperAlarmIntervalIndex);
},
));


});

test('never pick undefined intervals for relative alarms', () => {
Expand All @@ -77,8 +69,6 @@ describe('intervals', () => {
&& (alarms.upperAlarmIntervalIndex === undefined || intervals[alarms.upperAlarmIntervalIndex].change !== undefined);
},
));


});

test('pick intervals on either side of the undefined interval, if present', () => {
Expand All @@ -93,8 +83,6 @@ describe('intervals', () => {
return (alarms.lowerAlarmIntervalIndex === i - 1 && alarms.upperAlarmIntervalIndex === i + 1);
},
));


});

test('no picking upper bound infinity for lower alarm', () => {
Expand All @@ -107,8 +95,6 @@ describe('intervals', () => {
return intervals[alarms.lowerAlarmIntervalIndex!].upper !== Infinity;
},
));


});

test('no picking lower bound 0 for upper alarm', () => {
Expand All @@ -121,8 +107,6 @@ describe('intervals', () => {
return intervals[alarms.upperAlarmIntervalIndex!].lower !== 0;
},
));


});
});

Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-cloudformation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert-internal": "0.0.0",
"@aws-cdk/assertions": "0.0.0",
"@aws-cdk/aws-events": "0.0.0",
"@aws-cdk/aws-s3-assets": "0.0.0",
"@aws-cdk/aws-sns-subscriptions": "0.0.0",
Expand Down
Loading

0 comments on commit 348d4ca

Please sign in to comment.