Skip to content

Commit 921611e

Browse files
Fix breaking legacy table version
1 parent 18d8d32 commit 921611e

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

localstack-core/localstack/services/dynamodb/provider.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -852,13 +852,10 @@ def describe_table(
852852

853853
# Set defaults for warm throughput
854854
if "WarmThroughput" not in table_description:
855+
billing_mode = table_definitions.get("BillingMode") if table_definitions else None
855856
table_description["WarmThroughput"] = {
856-
"ReadUnitsPerSecond": 12000
857-
if table_definitions.get("BillingMode") == "PAY_PER_REQUEST"
858-
else 5,
859-
"WriteUnitsPerSecond": 4000
860-
if table_definitions.get("BillingMode") == "PAY_PER_REQUEST"
861-
else 5,
857+
"ReadUnitsPerSecond": 12000 if billing_mode == "PAY_PER_REQUEST" else 5,
858+
"WriteUnitsPerSecond": 4000 if billing_mode == "PAY_PER_REQUEST" else 5,
862859
}
863860
table_description["WarmThroughput"]["Status"] = (
864861
table_description.get("TableStatus") or "ACTIVE"

localstack-core/localstack/services/dynamodb/v2/provider.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -663,9 +663,10 @@ def describe_table(
663663

664664
# Set defaults for warm throughput
665665
if "WarmThroughput" not in table_description:
666+
billing_mode = table_definitions.get("BillingMode") if table_definitions else None
666667
table_description["WarmThroughput"] = {
667-
"ReadUnitsPerSecond": 5,
668-
"WriteUnitsPerSecond": 5,
668+
"ReadUnitsPerSecond": 12000 if billing_mode == "PAY_PER_REQUEST" else 5,
669+
"WriteUnitsPerSecond": 4000 if billing_mode == "PAY_PER_REQUEST" else 5,
669670
}
670671
table_description["WarmThroughput"]["Status"] = (
671672
table_description.get("TableStatus") or "ACTIVE"

tests/aws/services/dynamodb/test_dynamodb.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2017,6 +2017,9 @@ def test_dynamodb_create_table_with_sse_specification(
20172017
assert result["TableDescription"]["SSEDescription"]["KMSMasterKeyArn"] == kms_master_key_arn
20182018

20192019
@markers.aws.validated
2020+
@markers.snapshot.skip_snapshot_verify(
2021+
paths=["$..KeyMetadata.CurrentKeyMaterialId"] # Not supported by LS
2022+
)
20202023
def test_dynamodb_create_table_with_partial_sse_specification(
20212024
self, dynamodb_create_table_with_parameters, snapshot, aws_client
20222025
):
@@ -2051,6 +2054,9 @@ def test_dynamodb_create_table_with_partial_sse_specification(
20512054
assert "SSESpecification" not in result["Table"]
20522055

20532056
@markers.aws.validated
2057+
@markers.snapshot.skip_snapshot_verify(
2058+
paths=["$..KeyMetadata.CurrentKeyMaterialId"] # Not supported by LS
2059+
)
20542060
def test_dynamodb_update_table_without_sse_specification_change(
20552061
self, dynamodb_create_table_with_parameters, snapshot, aws_client
20562062
):

0 commit comments

Comments
 (0)