From d6c438400eaf3e2c94eac0ea2043d230518fe50b Mon Sep 17 00:00:00 2001 From: rafcio19 Date: Tue, 22 Nov 2022 17:25:47 +0000 Subject: [PATCH] DDB transaction limit increased to 100 (#5696) --- moto/dynamodb/exceptions.py | 5 ++++- moto/dynamodb/models/__init__.py | 2 +- tests/test_dynamodb/exceptions/test_dynamodb_exceptions.py | 7 +++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/moto/dynamodb/exceptions.py b/moto/dynamodb/exceptions.py index 0376abb03..30aba61ce 100644 --- a/moto/dynamodb/exceptions.py +++ b/moto/dynamodb/exceptions.py @@ -229,7 +229,10 @@ class MultipleTransactionsException(MockValidationException): class TooManyTransactionsException(MockValidationException): - msg = "Validation error at transactItems: Member must have length less than or equal to 25." + msg = ( + "1 validation error detected at 'transactItems' failed to satisfy constraint: " + "Member must have length less than or equal to 100." + ) def __init__(self): super().__init__(self.msg) diff --git a/moto/dynamodb/models/__init__.py b/moto/dynamodb/models/__init__.py index 90573a0fb..d02a2c5c6 100644 --- a/moto/dynamodb/models/__init__.py +++ b/moto/dynamodb/models/__init__.py @@ -1648,7 +1648,7 @@ class DynamoDBBackend(BaseBackend): return table.ttl def transact_write_items(self, transact_items): - if len(transact_items) > 25: + if len(transact_items) > 100: raise TooManyTransactionsException() # Create a backup in case any of the transactions fail original_table_state = copy.deepcopy(self.tables) diff --git a/tests/test_dynamodb/exceptions/test_dynamodb_exceptions.py b/tests/test_dynamodb/exceptions/test_dynamodb_exceptions.py index 069a2ba58..6271f7678 100644 --- a/tests/test_dynamodb/exceptions/test_dynamodb_exceptions.py +++ b/tests/test_dynamodb/exceptions/test_dynamodb_exceptions.py @@ -555,12 +555,15 @@ def test_transact_write_items__too_many_transactions(): with pytest.raises(ClientError) as exc: dynamodb.transact_write_items( TransactItems=[ - update_email_transact(f"test{idx}@moto.com") for idx in range(26) + update_email_transact(f"test{idx}@moto.com") for idx in range(101) ] ) err = exc.value.response["Error"] err["Code"].should.equal("ValidationException") - err["Message"].should.match("Member must have length less than or equal to 25") + err["Message"].should.match( + "1 validation error detected at 'transactItems' failed to satisfy constraint: " + "Member must have length less than or equal to 100." + ) @mock_dynamodb