Skip to content

Commit c928dc4

Browse files
authored
Merge pull request #3346 from aws/release-v1.75.0
Release 1.75.0 (to main)
2 parents 43f5744 + f3b0300 commit c928dc4

File tree

102 files changed

+15917
-2097
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+15917
-2097
lines changed

.cfnlintrc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ ignore_templates:
131131
- tests/translator/output/**/function_with_mq_using_autogen_role.json # Property "EventSourceArn" can Fn::GetAtt to a resource of types [AWS::DynamoDB::GlobalTable, AWS::DynamoDB::Table, AWS::Kinesis::Stream, AWS::Kinesis::StreamConsumer, AWS::SQS::Queue]
132132
- tests/translator/output/**/function_with_tracing.json # Obsolete DependsOn on resource
133133
- tests/translator/output/**/api_with_propagate_tags.json # TODO: Intentional error transform tests. Will be updated.
134+
- tests/translator/output/**/function_with_intrinsics_resource_attribute.json # CFN now supports intrinsics in DeletionPolicy
134135
ignore_checks:
135136
- E2531 # Deprecated runtime; not relevant for transform tests
136137
- W2531 # EOL runtime; not relevant for transform tests

bin/_file_formatter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ def decode_exception() -> Type[Exception]:
4141
def file_extension() -> str:
4242
"""Return file extension of files to format."""
4343

44-
@classmethod
45-
def config_additional_args(cls) -> None: # noqa: empty-method-without-abstract-decorator
44+
@classmethod # noqa: B027
45+
def config_additional_args(cls) -> None:
4646
"""Optionally configure additional args to arg parser."""
4747

4848
def process_file(self, file_path: Path) -> None:

integration/combination/test_connectors.py

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
from time import sleep
22
from unittest import SkipTest
3+
from unittest.case import skipIf
34

45
from parameterized import parameterized
56
from tenacity import retry, retry_if_exception, stop_after_attempt
67

8+
from integration.config.service_names import SCHEDULE_EVENT
79
from integration.conftest import clean_bucket
8-
from integration.helpers.base_test import S3_BUCKET_PREFIX, BaseTest
9-
from integration.helpers.resource import generate_suffix
10+
from integration.helpers.base_test import S3_BUCKET_PREFIX, BaseTest, nonblocking
11+
from integration.helpers.resource import current_region_does_not_support, generate_suffix
1012

1113
retry_once = retry(
1214
stop=stop_after_attempt(2),
@@ -15,6 +17,37 @@
1517
)
1618

1719

20+
# Explicitly move EB tests out to handlle the failed test in some regions.
21+
# In those regions, the tests should have been skipped but somehow not.
22+
# Test using `skipIf` to see if it helps.
23+
@skipIf(
24+
current_region_does_not_support([SCHEDULE_EVENT]),
25+
"SCHEDULE_EVENT is not supported in this testing region",
26+
)
27+
@nonblocking
28+
class TestConnectorsWithEventBus(BaseTest):
29+
@parameterized.expand(
30+
[
31+
("combination/connector_function_to_eventbus_write",),
32+
]
33+
)
34+
@retry_once
35+
def test_connector_by_invoking_a_function_with_eventbus(self, template_file_path):
36+
self.create_and_verify_stack(template_file_path)
37+
38+
lambda_function_name = self.get_physical_id_by_logical_id("TriggerFunction")
39+
lambda_client = self.client_provider.lambda_client
40+
41+
request_params = {
42+
"FunctionName": lambda_function_name,
43+
"InvocationType": "RequestResponse",
44+
"Payload": "{}",
45+
}
46+
response = lambda_client.invoke(**request_params)
47+
self.assertEqual(response.get("StatusCode"), 200)
48+
self.assertEqual(response.get("FunctionError"), None)
49+
50+
1851
class TestConnectors(BaseTest):
1952
def tearDown(self):
2053
# Some tests will create items in S3 Bucket, which result in stack DELETE_FAILED state
@@ -42,7 +75,6 @@ def tearDown(self):
4275
("combination/connector_function_to_queue_write",),
4376
("combination/connector_function_to_queue_read",),
4477
("combination/connector_function_to_topic_write",),
45-
("combination/connector_function_to_eventbus_write",),
4678
("combination/connector_topic_to_queue_write",),
4779
("combination/connector_event_rule_to_sqs_write",),
4880
("combination/connector_event_rule_to_sns_write",),
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from unittest.case import skipIf
2+
3+
from integration.config.service_names import REST_API
4+
from integration.helpers.base_test import BaseTest
5+
from integration.helpers.resource import current_region_does_not_support
6+
7+
8+
@skipIf(current_region_does_not_support([REST_API]), "REST API is not supported in this testing region")
9+
class TestFunctionWithImplicitApiWithTimeout(BaseTest):
10+
def test_function_with_implicit_api_with_timeout(self):
11+
self.create_and_verify_stack("combination/function_with_implicit_api_with_timeout")
12+
13+
# verify that TimeoutInMillis is set to expected value in the integration
14+
expected_timeout = 5000
15+
apigw_client = self.client_provider.api_client
16+
rest_api_id = self.get_physical_id_by_type("AWS::ApiGateway::RestApi")
17+
resources = apigw_client.get_resources(restApiId=rest_api_id)["items"]
18+
19+
resource = get_resource_by_path(resources, "/hello")
20+
method = apigw_client.get_method(restApiId=rest_api_id, resourceId=resource["id"], httpMethod="GET")
21+
method_integration = method["methodIntegration"]
22+
self.assertEqual(method_integration["timeoutInMillis"], expected_timeout)
23+
24+
25+
def get_resource_by_path(resources, path):
26+
for resource in resources:
27+
if resource["path"] == path:
28+
return resource
29+
return None
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from integration.helpers.base_test import BaseTest
2+
3+
4+
class TestFunctionWithIntrinsicsResourceAttributes(BaseTest):
5+
def test_function_with_intrinsics_resource_attributes(self):
6+
# simply verify the stack is deployed successfully is enough
7+
self.create_and_verify_stack("combination/function_with_intrinsics_resource_attribute")
8+
9+
stack_outputs = self.get_stack_outputs()
10+
id_dev_stack = stack_outputs["IsDevStack"]
11+
self.assertEqual(id_dev_stack, "true")

integration/combination/test_function_with_schedule_dlq_generated.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,6 @@ def test_function_with_schedule(self):
8484

8585

8686
def get_first_key_value_pair_in_dict(dictionary):
87-
key = list(dictionary.keys())[0]
87+
key = next(iter(dictionary.keys()))
8888
value = dictionary[key]
8989
return key, value

integration/combination/test_state_machine_with_cwe_dlq_generated.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,6 @@ def test_state_machine_with_cwe(self):
110110

111111

112112
def get_first_key_value_pair_in_dict(dictionary):
113-
key = list(dictionary.keys())[0]
113+
key = next(iter(dictionary.keys()))
114114
value = dictionary[key]
115115
return key, value

integration/combination/test_state_machine_with_schedule_dlq_generated.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,6 @@ def test_state_machine_with_schedule(self):
7979

8080

8181
def get_first_key_value_pair_in_dict(dictionary):
82-
key = list(dictionary.keys())[0]
82+
key = next(iter(dictionary.keys()))
8383
value = dictionary[key]
8484
return key, value

integration/helpers/base_test.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -536,9 +536,7 @@ def verify_get_request_response(self, url, expected_status_code, headers=None):
536536
response = self.do_get_request_with_logging(url, headers)
537537
if response.status_code != expected_status_code:
538538
raise StatusCodeError(
539-
"Request to {} failed with status: {}, expected status: {}".format(
540-
url, response.status_code, expected_status_code
541-
)
539+
f"Request to {url} failed with status: {response.status_code}, expected status: {expected_status_code}"
542540
)
543541
return response
544542

@@ -565,9 +563,7 @@ def verify_options_request(self, url, expected_status_code, headers=None):
565563
response = self.do_options_request_with_logging(url, headers)
566564
if response.status_code != expected_status_code:
567565
raise StatusCodeError(
568-
"Request to {} failed with status: {}, expected status: {}".format(
569-
url, response.status_code, expected_status_code
570-
)
566+
f"Request to {url} failed with status: {response.status_code}, expected status: {expected_status_code}"
571567
)
572568
return response
573569

@@ -576,9 +572,7 @@ def verify_post_request(self, url: str, body_obj, expected_status_code: int):
576572
response = self.do_post_request(url, body_obj)
577573
if response.status_code != expected_status_code:
578574
raise StatusCodeError(
579-
"Request to {} failed with status: {}, expected status: {}".format(
580-
url, response.status_code, expected_status_code
581-
)
575+
f"Request to {url} failed with status: {response.status_code}, expected status: {expected_status_code}"
582576
)
583577
return response
584578

integration/helpers/deployer/deployer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ def _display_stack_outputs(self, stack_outputs, **kwargs):
388388
("Value", output.get("OutputValue")),
389389
]:
390390
pprint_columns(
391-
columns=["{k:<{0}}{v:<{0}}".format(MIN_OFFSET, k=k, v=v)],
391+
columns=[f"{k:<{MIN_OFFSET}}{v:<{MIN_OFFSET}}"],
392392
width=kwargs["width"],
393393
margin=kwargs["margin"],
394394
format_string=OUTPUTS_FORMAT_STRING,

0 commit comments

Comments
 (0)