Skip to content

Commit f63d437

Browse files
leandrodamascenarubenfonseca
authored andcommitted
bug(v2/idempotency-e2e): fixing e2e tests
1 parent b31786d commit f63d437

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

tests/e2e/idempotency/handlers/parallel_execution_handler.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010
@idempotent(persistence_store=persistence_layer)
1111
def lambda_handler(event, context):
1212

13-
time.sleep(10)
13+
time.sleep(5)
1414

1515
return event

tests/e2e/idempotency/handlers/ttl_cache_expiration_handler.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
TABLE_NAME = os.getenv("IdempotencyTable", "")
77
persistence_layer = DynamoDBPersistenceLayer(table_name=TABLE_NAME)
8-
config = IdempotencyConfig(expires_after_seconds=20)
8+
config = IdempotencyConfig(expires_after_seconds=5)
99

1010

1111
@idempotent(config=config, persistence_store=persistence_layer)

tests/e2e/idempotency/test_idempotency_dynamodb.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def idempotency_table_name(infrastructure: dict) -> str:
2929

3030
def test_ttl_caching_expiration_idempotency(ttl_cache_expiration_handler_fn_arn: str):
3131
# GIVEN
32-
payload = json.dumps({"message": "Lambda Powertools - TTL 20s"})
32+
payload = json.dumps({"message": "Lambda Powertools - TTL 5s"})
3333

3434
# WHEN
3535
# first execution
@@ -44,8 +44,8 @@ def test_ttl_caching_expiration_idempotency(ttl_cache_expiration_handler_fn_arn:
4444
)
4545
second_execution_response = second_execution["Payload"].read().decode("utf-8")
4646

47-
# wait 20s to expire ttl and execute again, this should return a new response value
48-
sleep(20)
47+
# wait 8s to expire ttl and execute again, this should return a new response value
48+
sleep(8)
4949
third_execution, _ = data_fetcher.get_lambda_response(
5050
lambda_arn=ttl_cache_expiration_handler_fn_arn, payload=payload
5151
)
@@ -58,7 +58,7 @@ def test_ttl_caching_expiration_idempotency(ttl_cache_expiration_handler_fn_arn:
5858

5959
def test_ttl_caching_timeout_idempotency(ttl_cache_timeout_handler_fn_arn: str):
6060
# GIVEN
61-
payload_timeout_execution = json.dumps({"sleep": 10, "message": "Lambda Powertools - TTL 1s"})
61+
payload_timeout_execution = json.dumps({"sleep": 5, "message": "Lambda Powertools - TTL 1s"})
6262
payload_working_execution = json.dumps({"sleep": 0, "message": "Lambda Powertools - TTL 1s"})
6363

6464
# WHEN

0 commit comments

Comments
 (0)