mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(cloudformation): honor DynamoDB on-demand billing mode (#7931)
This commit is contained in:
1 parent
77cb014f9d
commit
b3de4b3179
11 files changed
+52
-9
No files matched your search
+3
@@ -83,6 +83,9 @@ class CloudFormationDynamoDbGlobalTableIntegrationTest {
|
||||
assertStackStatus(stackName, "CREATE_COMPLETE");
|
||||
|
||||
JsonPath described = describeTable(tableName).jsonPath();
|
||||
assertEquals("PAY_PER_REQUEST", described.getString("Table.BillingModeSummary.BillingMode"));
|
||||
assertEquals(0L, described.getLong("Table.ProvisionedThroughput.ReadCapacityUnits"));
|
||||
assertEquals(0L, described.getLong("Table.ProvisionedThroughput.WriteCapacityUnits"));
|
||||
String tableArn = described.getString("Table.TableArn");
|
||||
String tableId = described.getString("Table.TableId");
|
||||
assertTrue(tableArn != null && tableArn.startsWith("arn:aws:dynamodb:"), "TableArn: " + tableArn);
|
||||
|
||||
+5
@@ -93,6 +93,11 @@ class CloudFormationDynamoDbTimeToLiveIntegrationTest {
|
||||
|
||||
cloudFormation(stack, "CreateStack", TEMPLATE.formatted(table, "dev", TTL_ENABLED, ""));
|
||||
assertEquals("CREATE_COMPLETE", CfnStackWaits.awaitTerminal(stack, CFN_AUTH).status());
|
||||
dynamoDb("DescribeTable", "{\"TableName\": \"" + table + "\"}")
|
||||
.statusCode(200)
|
||||
.body("Table.BillingModeSummary.BillingMode", equalTo("PAY_PER_REQUEST"))
|
||||
.body("Table.ProvisionedThroughput.ReadCapacityUnits", equalTo(0))
|
||||
.body("Table.ProvisionedThroughput.WriteCapacityUnits", equalTo(0));
|
||||
describeTimeToLive(table)
|
||||
.body("TimeToLiveDescription.TimeToLiveStatus", equalTo("ENABLED"))
|
||||
.body("TimeToLiveDescription.AttributeName", equalTo("expiresAt"));
|
||||
|
||||
+2
@@ -58,6 +58,8 @@ class DynamoDbStreamSpecificationCfnProvisionerTest {
|
||||
created.setTableArn(TABLE_ARN);
|
||||
when(dynamoDbService.createTable(anyString(), anyList(), anyList(), any(), any(),
|
||||
anyList(), anyList(), anyString())).thenReturn(created);
|
||||
when(dynamoDbService.createTable(anyString(), anyList(), anyList(), any(), any(),
|
||||
anyList(), anyList(), anyList(), anyString(), anyString())).thenReturn(created);
|
||||
}
|
||||
|
||||
/** Make provisioning take the update path: the table already exists, with a live stream. */
|
||||
|
||||
@@ -91,6 +91,14 @@ public final class RecordingDynamoDbBackend implements DynamoDbItemAccess, Dynam
|
||||
return record("createTable", scope);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDefinition createOnDemandTable(Scope scope, String tableName, List<KeySchemaElement> keySchema,
|
||||
List<AttributeDefinition> attributeDefinitions,
|
||||
List<GlobalSecondaryIndex> globalSecondaryIndexes,
|
||||
List<LocalSecondaryIndex> localSecondaryIndexes) {
|
||||
return record("createOnDemandTable", scope);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDefinition describeTable(Scope scope, String tableName) {
|
||||
return record("describeTable", scope);
|
||||
|
||||
Reference in new issue
Block a user