Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DebugStack: allow customizing DynamoDB Table (#1814)
- Loading branch information
Showing
5 changed files
with
97 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@serverless-stack/resources": patch | ||
"@serverless-stack/docs": patch | ||
--- | ||
|
||
DebugStack: allow customizing DynamoDB Table |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { test, expect } from "vitest"; | ||
/* eslint-disable @typescript-eslint/ban-ts-comment*/ | ||
|
||
import { | ||
ABSENT, | ||
countResources, | ||
hasResource, | ||
hasResourceTemplate, | ||
} from "./helper"; | ||
import * as cdk from "aws-cdk-lib"; | ||
import * as lambda from "aws-cdk-lib/aws-lambda"; | ||
import * as dynamodb from "aws-cdk-lib/aws-dynamodb"; | ||
import { DebugApp, DebugStack } from "../src"; | ||
|
||
const lambdaDefaultPolicy = { | ||
Action: ["xray:PutTraceSegments", "xray:PutTelemetryRecords"], | ||
Effect: "Allow", | ||
Resource: "*", | ||
}; | ||
|
||
function createApp() { | ||
return new DebugApp({ | ||
name: "my-app", | ||
stage: "dev", | ||
region: "us-east-1", | ||
}) | ||
} | ||
|
||
///////////////////////////// | ||
// Test constructor | ||
///////////////////////////// | ||
|
||
test("cdk.table undefined", async () => { | ||
const stack = new DebugStack(createApp(), "stack"); | ||
hasResource(stack, "AWS::DynamoDB::Table", { | ||
TableName: ABSENT, | ||
PointInTimeRecoverySpecification: ABSENT, | ||
KeySchema: [{ AttributeName: "pk", KeyType: "HASH" }], | ||
}); | ||
}); | ||
|
||
test("cdk.table defined", async () => { | ||
const stack = new DebugStack(createApp(), "stack", { | ||
cdk: { | ||
table: { | ||
pointInTimeRecovery: true | ||
} | ||
} | ||
}); | ||
hasResource(stack, "AWS::DynamoDB::Table", { | ||
TableName: ABSENT, | ||
PointInTimeRecoverySpecification: { | ||
PointInTimeRecoveryEnabled: true, | ||
}, | ||
KeySchema: [{ AttributeName: "pk", KeyType: "HASH" }], | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters