Skip to content

Commit

Permalink
Get integration tests working
Browse files Browse the repository at this point in the history
  • Loading branch information
msambol committed Mar 27, 2024
1 parent 12852ae commit 89b108b
Show file tree
Hide file tree
Showing 27 changed files with 34,924 additions and 176 deletions.
4 changes: 3 additions & 1 deletion packages/@aws-cdk/aws-pipes-alpha/lib/pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,9 @@ export class Pipe extends PipeBase {
*/
const source = props.source.bind(this);
props.source.grantRead(this.pipeRole);
props.source.grantDlqPush(this.pipeRole);
if (props.source.grantDlqPush) {
props.source.grantDlqPush(this.pipeRole);
}

// Add the filter criteria to the source parameters
const sourceParameters : CfnPipe.PipeSourceParametersProperty= {
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-pipes-alpha/lib/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export interface ISource {
grantRead(grantee: IRole): void;

/**
* Grant the pipe role write access to the dead-letter targer.
* Grant the pipe role write access to the dead-letter target.
*/
grantDlqPush(grantee: IRole): void;
grantDlqPush?(grantee: IRole): void;
}
1 change: 0 additions & 1 deletion packages/@aws-cdk/aws-pipes-alpha/test/integ.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class TestSource implements ISource {
grantRead(pipeRole: cdk.aws_iam.IRole): void {
this.queue.grantConsumeMessages(pipeRole);
}
grantDlqPush(): void {}
}

class TestTarget implements ITarget {
Expand Down
20 changes: 10 additions & 10 deletions packages/@aws-cdk/aws-pipes-sources-alpha/lib/dynamodb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export interface DynamoDBSourceParameters {
/**
* The maximum number of records to include in each batch.
*
* Minumum = 1
* Maxiumum = 10000
* Minumum: 1
* Maxiumum: 10000
*
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipesourcedynamodbstreamparameters.html#cfn-pipes-pipe-pipesourcedynamodbstreamparameters-batchsize
* @default 1
Expand All @@ -32,8 +32,8 @@ export interface DynamoDBSourceParameters {
/**
* The maximum length of a time to wait for events.
*
* Minumum = Duration.seconds(0)
* Maxiumum = Duration.seconds(300)
* Minumum: Duration.seconds(0)
* Maxiumum: Duration.seconds(300)
*
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipesourcedynamodbstreamparameters.html#cfn-pipes-pipe-pipesourcedynamodbstreamparameters-maximumbatchingwindowinseconds
* @default - no batching window
Expand All @@ -43,8 +43,8 @@ export interface DynamoDBSourceParameters {
/**
* (Streams only) Discard records older than the specified age. The default value is -1, which sets the maximum age to infinite. When the value is set to infinite, EventBridge never discards old records.
*
* Minumum = Duration.seconds(60) (leave undefined to set the maximum age to -1)
* Maxiumum = Duration.seconds(604800)
* Minumum: Duration.seconds(60) (leave undefined to set the maximum age to -1)
* Maxiumum: Duration.seconds(604800)
*
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipesourcedynamodbstreamparameters.html#cfn-pipes-pipe-pipesourcedynamodbstreamparameters-maximumrecordageinseconds
* @default -1 - maximum age is infinite
Expand All @@ -54,8 +54,8 @@ export interface DynamoDBSourceParameters {
/**
* (Streams only) Discard records after the specified number of retries. The default value is -1, which sets the maximum number of retries to infinite. When MaximumRetryAttempts is infinite, EventBridge retries failed records until the record expires in the event source.
*
* Minumum = -1
* Maxiumum = 10000
* Minumum: -1
* Maxiumum: 10000
*
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipesourcedynamodbstreamparameters.html#cfn-pipes-pipe-pipesourcedynamodbstreamparameters-maximumretryattempts
* @default -1 (infinite)
Expand All @@ -73,8 +73,8 @@ export interface DynamoDBSourceParameters {
/**
* (Streams only) The number of batches to process concurrently from each shard.
*
* Minumum = 1
* Maxiumum = 10
* Minumum: 1
* Maxiumum: 10
*
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipesourcedynamodbstreamparameters.html#cfn-pipes-pipe-pipesourcedynamodbstreamparameters-parallelizationfactor
* @default 1
Expand Down
16 changes: 8 additions & 8 deletions packages/@aws-cdk/aws-pipes-sources-alpha/lib/kinesis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export interface KinesisSourceParameters {
/**
* The maximum number of records to include in each batch.
*
* Minumum = 1
* Maxiumum = 10000
* Minumum: 1
* Maxiumum: 10000
*
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipesourcekinesisstreamparameters.html#cfn-pipes-pipe-pipesourcekinesisstreamparameters-batchsize
* @default 1
Expand All @@ -32,8 +32,8 @@ export interface KinesisSourceParameters {
/**
* The maximum length of a time to wait for events.
*
* Minumum = Duration.seconds(0)
* Maxiumum = Duration.seconds(300)
* Minumum: Duration.seconds(0)
* Maxiumum: Duration.seconds(300)
*
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipesourcekinesisstreamparameters.html#cfn-pipes-pipe-pipesourcekinesisstreamparameters-maximumbatchingwindowinseconds
* @default - no batching window
Expand All @@ -43,8 +43,8 @@ export interface KinesisSourceParameters {
/**
* (Streams only) Discard records older than the specified age. The default value is -1, which sets the maximum age to infinite. When the value is set to infinite, EventBridge never discards old records.
*
* Minumum = Duration.seconds(60) (leave undefined to set the maximum age to -1)
* Maxiumum = Duration.seconds(604800)
* Minumum: Duration.seconds(60) (leave undefined to set the maximum age to -1)
* Maxiumum: Duration.seconds(604800)
*
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipesourcekinesisstreamparameters.html#cfn-pipes-pipe-pipesourcekinesisstreamparameters-maximumrecordageinseconds
* @default -1 - maximum age is infinite
Expand All @@ -54,8 +54,8 @@ export interface KinesisSourceParameters {
/**
* (Streams only) Discard records after the specified number of retries. The default value is -1, which sets the maximum number of retries to infinite. When MaximumRetryAttempts is infinite, EventBridge retries failed records until the record expires in the event source.
*
* Minumum = -1
* Maxiumum = 10000
* Minumum: -1
* Maxiumum: 10000
*
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-pipes-pipe-pipesourcekinesisstreamparameters.html#cfn-pipes-pipe-pipesourcekinesisstreamparameters-maximumretryattempts
* @default -1 (infinite)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`dynamodb source should grant pipe role read access 1`] = `
exports[`dynamodb source should grant pipe role read access to source 1`] = `
{
"MyPipeRoleCBC8E9AB": {
"Properties": {
Expand All @@ -22,7 +22,7 @@ exports[`dynamodb source should grant pipe role read access 1`] = `
}
`;

exports[`dynamodb source should grant pipe role read access 2`] = `
exports[`dynamodb source should grant pipe role read access to source 2`] = `
{
"MyPipeRoleDefaultPolicy31387C20": {
"Properties": {
Expand Down Expand Up @@ -66,3 +66,158 @@ exports[`dynamodb source should grant pipe role read access 2`] = `
},
}
`;

exports[`dynamodb source should grant pipe role write access to dead-letter queue 1`] = `
{
"MyPipeRoleCBC8E9AB": {
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "pipes.amazonaws.com",
},
},
],
"Version": "2012-10-17",
},
},
"Type": "AWS::IAM::Role",
},
}
`;

exports[`dynamodb source should grant pipe role write access to dead-letter queue 2`] = `
{
"MyPipeRoleDefaultPolicy31387C20": {
"Properties": {
"PolicyDocument": {
"Statement": [
{
"Action": "dynamodb:ListStreams",
"Effect": "Allow",
"Resource": {
"Fn::GetAtt": [
"MyTable794EDED1",
"StreamArn",
],
},
},
{
"Action": [
"dynamodb:DescribeStream",
"dynamodb:GetRecords",
"dynamodb:GetShardIterator",
],
"Effect": "Allow",
"Resource": {
"Fn::GetAtt": [
"MyTable794EDED1",
"StreamArn",
],
},
},
{
"Action": [
"sqs:SendMessage",
"sqs:GetQueueAttributes",
"sqs:GetQueueUrl",
],
"Effect": "Allow",
"Resource": {
"Fn::GetAtt": [
"MyDlq41B41CC5",
"Arn",
],
},
},
],
"Version": "2012-10-17",
},
"PolicyName": "MyPipeRoleDefaultPolicy31387C20",
"Roles": [
{
"Ref": "MyPipeRoleCBC8E9AB",
},
],
},
"Type": "AWS::IAM::Policy",
},
}
`;

exports[`dynamodb source should grant pipe role write access to dead-letter topic 1`] = `
{
"MyPipeRoleCBC8E9AB": {
"Properties": {
"AssumeRolePolicyDocument": {
"Statement": [
{
"Action": "sts:AssumeRole",
"Effect": "Allow",
"Principal": {
"Service": "pipes.amazonaws.com",
},
},
],
"Version": "2012-10-17",
},
},
"Type": "AWS::IAM::Role",
},
}
`;

exports[`dynamodb source should grant pipe role write access to dead-letter topic 2`] = `
{
"MyPipeRoleDefaultPolicy31387C20": {
"Properties": {
"PolicyDocument": {
"Statement": [
{
"Action": "dynamodb:ListStreams",
"Effect": "Allow",
"Resource": {
"Fn::GetAtt": [
"MyTable794EDED1",
"StreamArn",
],
},
},
{
"Action": [
"dynamodb:DescribeStream",
"dynamodb:GetRecords",
"dynamodb:GetShardIterator",
],
"Effect": "Allow",
"Resource": {
"Fn::GetAtt": [
"MyTable794EDED1",
"StreamArn",
],
},
},
{
"Action": "sns:Publish",
"Effect": "Allow",
"Resource": {
"Ref": "MyTopic86869434",
},
},
],
"Version": "2012-10-17",
},
"PolicyName": "MyPipeRoleDefaultPolicy31387C20",
"Roles": [
{
"Ref": "MyPipeRoleCBC8E9AB",
},
],
},
"Type": "AWS::IAM::Policy",
},
}
`;
Loading

0 comments on commit 89b108b

Please sign in to comment.