Skip to content

Commit

Permalink
Merge branch 'main' into niroam-ec2-instance-type-p5
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] committed Nov 2, 2023
2 parents fa51b63 + b02752b commit 5f1df97
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"S3Bucket": {
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}"
},
"S3Key": "1e14e895fcbdf65feb0a29e4aa74c6c92a6fb0e41f228bef7ab23627ed409cde.zip"
"S3Key": "3e61d858eaa7724170872a455b8f788d5fcf18adba89aadbe603a52dab59d917.zip"
},
"Timeout": 900,
"MemorySize": 128,
Expand Down
2 changes: 2 additions & 0 deletions packages/aws-cdk-lib/aws-rds/lib/cluster-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,8 @@ export class AuroraMysqlEngineVersion {
public static readonly VER_3_03_1 = AuroraMysqlEngineVersion.builtIn_8_0('3.03.1');
/** Version "8.0.mysql_aurora.3.04.0". */
public static readonly VER_3_04_0 = AuroraMysqlEngineVersion.builtIn_8_0('3.04.0');
/** Version "8.0.mysql_aurora.3.05.0". */
public static readonly VER_3_05_0 = AuroraMysqlEngineVersion.builtIn_8_0('3.05.0');

/**
* Create a new AuroraMysqlEngineVersion with an arbitrary version.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export async function handler(event: AWSLambda.CloudFormationCustomResourceEvent
return cfnJsonStringifyHandler(event);
}

throw new Error(`unexpected resource type "${event.ResourceType}`);
throw new Error(`unexpected resource type "${event.ResourceType}"`);
}

function cfnJsonHandler(event: AWSLambda.CloudFormationCustomResourceEvent) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import { CfnUtilsResourceType } from '../../lib/private/cfn-utils-provider/consts';
import { handler } from '../../lib/private/cfn-utils-provider/index';

test('parses value as JSON', async () => {
// GIVEN
const event: Partial<AWSLambda.CloudFormationCustomResourceEvent> = {
ResourceType: CfnUtilsResourceType.CFN_JSON,
ResourceProperties: {
ServiceToken: 'Foo',
RepositoryName: 'MyRepo',
Value: JSON.stringify({
test: 'Random',
}),
},
};

// WHEN
const response = await invokeHandler(event);

// THEN
expect(response).toEqual({
Data: {
Value: {
test: 'Random',
},
},
});
});

test('format JSON value as string', async () => {
// GIVEN
const event: Partial<AWSLambda.CloudFormationCustomResourceEvent> = {
ResourceType: CfnUtilsResourceType.CFN_JSON_STRINGIFY,
ResourceProperties: {
ServiceToken: 'Foo',
RepositoryName: 'MyRepo',
Value: {
test: 'Random',
},
},
};

// WHEN
const response = await invokeHandler(event);

// THEN
expect(response).toEqual({
Data: {
Value: JSON.stringify({
test: 'Random',
}),
},
});
});

test('fails if wrong resource type', async () => {
// GIVEN
const event: Partial<AWSLambda.CloudFormationCustomResourceEvent> = {
ResourceType: 'Create',
ResourceProperties: {
ServiceToken: 'Foo',
RepositoryName: 'MyRepo',
},
};

// WHEN
await expect(() => invokeHandler(event)).rejects.toThrow(/unexpected resource type "Create"/);
});

// helper function to get around TypeScript expecting a complete event object,
// even though our tests only need some of the fields
async function invokeHandler(event: Partial<AWSLambda.CloudFormationCustomResourceEvent>) {
return handler(event as AWSLambda.CloudFormationCustomResourceEvent);
}

0 comments on commit 5f1df97

Please sign in to comment.