Skip to content

Commit 90b55e5

Browse files
authored
chore: Add region skip condition and retry for http test (#2455)
* Add skip and retry for http test * Black reformatting
1 parent a624451 commit 90b55e5

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

integration/single/test_function_with_http_api_and_auth.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
1+
import logging
2+
from unittest.case import skipIf
3+
4+
from tenacity import stop_after_attempt, retry_if_exception_type, after_log, wait_exponential, retry, wait_random
5+
16
from integration.helpers.base_test import BaseTest
7+
from integration.helpers.resource import current_region_does_not_support
8+
9+
LOG = logging.getLogger(__name__)
210

311

12+
@skipIf(current_region_does_not_support(["HttpApi"]), "HttpApi is not supported in this testing region")
413
class TestFunctionWithHttpApiAndAuth(BaseTest):
514
"""
615
AWS::Lambda::Function tests with http api events and auth
716
"""
817

18+
@retry(
19+
stop=stop_after_attempt(5),
20+
wait=wait_exponential(multiplier=1, min=4, max=10) + wait_random(0, 1),
21+
retry=retry_if_exception_type(AssertionError),
22+
after=after_log(LOG, logging.WARNING),
23+
reraise=True,
24+
)
925
def test_function_with_http_api_and_auth(self):
1026
# If the request is not signed, which none of the below are, IAM will respond with a "Forbidden" message.
1127
# We are not testing that IAM auth works here, we are simply testing if it was applied.

0 commit comments

Comments
 (0)