Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): upgrade dependencies #299

Merged
merged 2 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading