Skip to content

Commit

Permalink
chore(deps): upgrade dependencies (#299)
Browse files Browse the repository at this point in the history
Upgrades project dependencies. See details in [workflow run].

[Workflow Run]: https://github.com/cdklabs/cdk-ecs-codedeploy/actions/runs/6540721956

------

*Automatically created by projen via the "upgrade-main" workflow*
  • Loading branch information
cdklabs-automation authored Oct 17, 2023
1 parent 4f90285 commit e929777
Show file tree
Hide file tree
Showing 5 changed files with 190 additions and 198 deletions.
6 changes: 3 additions & 3 deletions package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions src/ecs-deployment-provider/on-event.lambda.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CodeDeploy } from '@aws-sdk/client-codedeploy';
import { AutoRollbackConfiguration, AutoRollbackEvent, CodeDeploy } from '@aws-sdk/client-codedeploy';
import { Logger } from './logger';

/**
Expand Down Expand Up @@ -126,11 +126,11 @@ export async function handler(event: OnEventRequest): Promise<OnEventResponse> {
case 'Update': {
// create deployment
const props = event.ResourceProperties;
let autoRollbackConfiguration;
let autoRollbackConfiguration : AutoRollbackConfiguration | undefined;
if (props.autoRollbackConfigurationEnabled === 'true') {
autoRollbackConfiguration = {
enabled: true,
events: props.autoRollbackConfigurationEvents.split(','),
events: props.autoRollbackConfigurationEvents.split(',') as AutoRollbackEvent[],
};
} else if (props.autoRollbackConfigurationEnabled === 'false') {
autoRollbackConfiguration = {
Expand Down
18 changes: 9 additions & 9 deletions test/is-complete.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CodeDeployClient, GetDeploymentCommand } from '@aws-sdk/client-codedeploy';
import { CodeDeployClient, ErrorCode, GetDeploymentCommand } from '@aws-sdk/client-codedeploy';
import { mockClient } from 'aws-sdk-client-mock';
import lambdaTester from 'lambda-tester';
import { handler, IsCompleteRequest, IsCompleteResponse, DeploymentStatus } from '../src/ecs-deployment-provider/is-complete.lambda';
Expand Down Expand Up @@ -123,7 +123,7 @@ describe('isComplete', () => {
rollbackDeploymentId: '22222222',
},
errorInformation: {
code: 'xxx',
code: ErrorCode.ALARM_ACTIVE,
message: 'failure occurred',
},
},
Expand Down Expand Up @@ -157,7 +157,7 @@ describe('isComplete', () => {
rollbackDeploymentId: '22222222',
},
errorInformation: {
code: 'xxx',
code: ErrorCode.ALARM_ACTIVE,
message: 'failure occurred',
},
},
Expand All @@ -177,7 +177,7 @@ describe('isComplete', () => {
} as IsCompleteRequest)
.expectReject((error: Error) => {
expect(getDeploymentMock).toHaveReceivedCommandTimes(GetDeploymentCommand, 2);
expect(error.message).toEqual('Deployment Failed: [xxx] failure occurred');
expect(error.message).toEqual('Deployment Failed: [ALARM_ACTIVE] failure occurred');
});
});
test('Throws error when create deployment failed and no rollback found', () => {
Expand All @@ -188,7 +188,7 @@ describe('isComplete', () => {
deploymentInfo: {
status: DeploymentStatus.FAILED,
errorInformation: {
code: 'xxx',
code: ErrorCode.ALARM_ACTIVE,
message: 'failure occurred',
},
},
Expand All @@ -201,7 +201,7 @@ describe('isComplete', () => {
} as IsCompleteRequest)
.expectReject((error: Error) => {
expect(getDeploymentMock).toHaveReceivedCommandTimes(GetDeploymentCommand, 1);
expect(error.message).toEqual('Deployment Failed: [xxx] failure occurred');
expect(error.message).toEqual('Deployment Failed: [ALARM_ACTIVE] failure occurred');
});
});
test('Is complete when delete deployment succeeds', () => {
Expand Down Expand Up @@ -255,7 +255,7 @@ describe('isComplete', () => {
rollbackDeploymentId: '22222222',
},
errorInformation: {
code: 'xxx',
code: ErrorCode.ALARM_ACTIVE,
message: 'failure occurred',
},
},
Expand Down Expand Up @@ -286,7 +286,7 @@ describe('isComplete', () => {
deploymentInfo: {
status: DeploymentStatus.FAILED,
errorInformation: {
code: 'xxx',
code: ErrorCode.ALARM_ACTIVE,
message: 'failure occurred',
},
},
Expand All @@ -313,7 +313,7 @@ describe('isComplete', () => {
rollbackDeploymentId: '22222222',
},
errorInformation: {
code: 'xxx',
code: ErrorCode.ALARM_ACTIVE,
message: 'failure occurred',
},
},
Expand Down
8 changes: 4 additions & 4 deletions test/on-event.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CodeDeployClient, CreateDeploymentCommand, StopDeploymentCommand } from '@aws-sdk/client-codedeploy';
import { AutoRollbackEvent, CodeDeployClient, CreateDeploymentCommand, StopDeploymentCommand, StopStatus } from '@aws-sdk/client-codedeploy';
import { mockClient } from 'aws-sdk-client-mock';
import lambdaTester from 'lambda-tester';
import { handler, OnEventRequest, OnEventResponse } from '../src/ecs-deployment-provider/on-event.lambda';
Expand Down Expand Up @@ -32,7 +32,7 @@ describe('onEvent', () => {
deploymentConfigName: 'testdeployconfig',
deploymentGroupName: 'testdeploygroup',
autoRollbackConfigurationEnabled: 'true',
autoRollbackConfigurationEvents: 'event1,event2',
autoRollbackConfigurationEvents: 'DEPLOYMENT_STOP_ON_ALARM,DEPLOYMENT_FAILURE',
description: 'testing',
revisionAppSpecContent: 'appspec-goes-here',
},
Expand All @@ -45,7 +45,7 @@ describe('onEvent', () => {
deploymentGroupName: 'testdeploygroup',
autoRollbackConfiguration: {
enabled: true,
events: ['event1', 'event2'],
events: [AutoRollbackEvent.DEPLOYMENT_STOP_ON_ALARM, AutoRollbackEvent.DEPLOYMENT_FAILURE],
},
description: 'testing',
revision: {
Expand Down Expand Up @@ -160,7 +160,7 @@ describe('onEvent', () => {

test('Delete deployment successfully stops', () => {
codeDeployMock.on(StopDeploymentCommand).resolves({
status: 'ok',
status: StopStatus.SUCCEEDED,
statusMessage: 'successfully stopped',
});

Expand Down
Loading

0 comments on commit e929777

Please sign in to comment.