From 8e96bb1577ef98fc280efe2f1782309c1e867484 Mon Sep 17 00:00:00 2001 From: Leandro Damascena Date: Thu, 12 Sep 2024 16:16:31 +0100 Subject: [PATCH] Fix Idempotency test --- tests/e2e/idempotency/infrastructure.py | 4 ++-- tests/e2e/idempotency/test_idempotency_dynamodb.py | 2 +- tests/e2e/idempotency_redis/infrastructure.py | 2 ++ tests/e2e/idempotency_redis/test_idempotency_redis.py | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/e2e/idempotency/infrastructure.py b/tests/e2e/idempotency/infrastructure.py index d42cc67d40d..845b708b0b0 100644 --- a/tests/e2e/idempotency/infrastructure.py +++ b/tests/e2e/idempotency/infrastructure.py @@ -1,4 +1,4 @@ -from aws_cdk import CfnOutput, RemovalPolicy +from aws_cdk import CfnOutput, Duration, RemovalPolicy from aws_cdk import aws_dynamodb as dynamodb from aws_cdk.aws_dynamodb import Table @@ -7,7 +7,7 @@ class IdempotencyDynamoDBStack(BaseInfrastructure): def create_resources(self): - table = self._create_dynamodb_table() + table = self._create_dynamodb_table(function_props={"timeout": Duration.seconds(10)}) env_vars = {"IdempotencyTable": table.table_name} functions = self.create_lambda_functions(function_props={"environment": env_vars}) diff --git a/tests/e2e/idempotency/test_idempotency_dynamodb.py b/tests/e2e/idempotency/test_idempotency_dynamodb.py index fdd1b79259b..ea4a319b76e 100644 --- a/tests/e2e/idempotency/test_idempotency_dynamodb.py +++ b/tests/e2e/idempotency/test_idempotency_dynamodb.py @@ -83,7 +83,7 @@ def test_ttl_caching_expiration_idempotency(ttl_cache_expiration_handler_fn_arn: def test_ttl_caching_timeout_idempotency(ttl_cache_timeout_handler_fn_arn: str): # GIVEN payload_timeout_execution = json.dumps( - {"sleep": 5, "message": "Powertools for AWS Lambda (Python) - TTL 1s"}, + {"sleep": 12, "message": "Powertools for AWS Lambda (Python) - TTL 1s"}, sort_keys=True, ) payload_working_execution = json.dumps( diff --git a/tests/e2e/idempotency_redis/infrastructure.py b/tests/e2e/idempotency_redis/infrastructure.py index 798b45c0fc8..774db857043 100644 --- a/tests/e2e/idempotency_redis/infrastructure.py +++ b/tests/e2e/idempotency_redis/infrastructure.py @@ -1,6 +1,7 @@ import time from typing import Tuple +from aws_cdk import Duration from aws_cdk import aws_ec2 as ec2 from aws_cdk.aws_ec2 import ( SecurityGroup, @@ -30,6 +31,7 @@ def create_resources(self) -> None: "environment": env_vars, "vpc": vpc_stack, "security_groups": [security_groups[1]], + "timeout": Duration.seconds(10), }, ) diff --git a/tests/e2e/idempotency_redis/test_idempotency_redis.py b/tests/e2e/idempotency_redis/test_idempotency_redis.py index 4b5840ac477..47b16760b82 100644 --- a/tests/e2e/idempotency_redis/test_idempotency_redis.py +++ b/tests/e2e/idempotency_redis/test_idempotency_redis.py @@ -69,7 +69,7 @@ def test_ttl_caching_expiration_idempotency(ttl_cache_expiration_handler_fn_arn: def test_ttl_caching_timeout_idempotency(ttl_cache_timeout_handler_fn_arn: str): # GIVEN payload_timeout_execution = json.dumps( - {"sleep": 5, "message": "Powertools for AWS Lambda (Python) - TTL 1s"}, + {"sleep": 12, "message": "Powertools for AWS Lambda (Python) - TTL 1s"}, sort_keys=True, ) payload_working_execution = json.dumps(