From 8973f21d15973d9ffe3106c8ecf2879d8a0c5603 Mon Sep 17 00:00:00 2001 From: Bert Blommers Date: Sun, 12 Jun 2022 17:53:27 +0000 Subject: [PATCH] Prepare release 3.1.13 (#5219) --- CHANGELOG.md | 39 ++++++++++++++ IMPLEMENTATION_COVERAGE.md | 53 +++++++++++-------- .../configuration/state_transition/models.rst | 2 +- docs/docs/contributing/installation.rst | 2 +- docs/docs/services/dms.rst | 9 ++++ docs/docs/services/ec2.rst | 2 +- docs/docs/services/greengrass.rst | 28 +++++----- docs/docs/services/redshift.rst | 1 + docs/docs/services/route53.rst | 4 +- docs/docs/services/sso-admin.rst | 10 ++-- moto/route53/urls.py | 2 +- scripts/implementation_coverage.py | 3 +- tests/test_route53/test_route53.py | 33 ++++++++++++ tests/test_route53/test_route53_boto3.py | 44 +++++++++++++++ .../test_route53_delegationsets.py | 1 - tests/test_sns/test_publishing_boto3.py | 17 +++--- 16 files changed, 195 insertions(+), 55 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f4060df6..3bf87e9f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,45 @@ Moto Changelog ============== +3.1.13 +----- +Docker Digest for 3.1.13: + + New Methods: + * EC2: + * create_default_vpc() + + * Greengrass: + * create_device_definition() + * create_device_definition_version() + * delete_core_definition() + * delete_device_definition() + * get_core_definition() + * get_core_definition_version() + * get_device_definition() + * get_device_definition_version() + * list_core_definitions() + * list_core_definition_versions() + * list_device_definitions() + * list_device_definition_versions() + * update_core_definition() + * update_device_definition() + + * SSO Admin: + * create_permission_set() + * delete_permission_set() + * describe_permission_set() + * list_permission_sets() + * update_permission_set() + + * Route53: + * get_dnssec() + * get_health_check() + + * Miscellaneous: + * StateManager now supports `s3::keyrestore`, managing how long it takes to restore S3 objects from Glacier. + + 3.1.12 ----- Docker Digest for 3.1.12: _sha256:64dcfb63b252b3413481683b90f105d01644b6bec150b60e6f612a2569ee630c_ diff --git a/IMPLEMENTATION_COVERAGE.md b/IMPLEMENTATION_COVERAGE.md index 1934b69fe..5c2a07ca2 100644 --- a/IMPLEMENTATION_COVERAGE.md +++ b/IMPLEMENTATION_COVERAGE.md @@ -1219,13 +1219,14 @@ ## dms
-9% implemented +7% implemented - [ ] add_tags_to_resource - [ ] apply_pending_maintenance_action - [ ] cancel_replication_task_assessment_run - [ ] create_endpoint - [ ] create_event_subscription +- [ ] create_fleet_advisor_collector - [ ] create_replication_instance - [ ] create_replication_subnet_group - [X] create_replication_task @@ -1233,6 +1234,8 @@ - [ ] delete_connection - [ ] delete_endpoint - [ ] delete_event_subscription +- [ ] delete_fleet_advisor_collector +- [ ] delete_fleet_advisor_databases - [ ] delete_replication_instance - [ ] delete_replication_subnet_group - [X] delete_replication_task @@ -1247,6 +1250,11 @@ - [ ] describe_event_categories - [ ] describe_event_subscriptions - [ ] describe_events +- [ ] describe_fleet_advisor_collectors +- [ ] describe_fleet_advisor_databases +- [ ] describe_fleet_advisor_lsa_analysis +- [ ] describe_fleet_advisor_schema_object_summary +- [ ] describe_fleet_advisor_schemas - [ ] describe_orderable_replication_instances - [ ] describe_pending_maintenance_actions - [ ] describe_refresh_schemas_status @@ -1271,6 +1279,7 @@ - [ ] refresh_schemas - [ ] reload_tables - [ ] remove_tags_from_resource +- [ ] run_fleet_advisor_lsa_analysis - [X] start_replication_task - [ ] start_replication_task_assessment - [ ] start_replication_task_assessment_run @@ -1483,7 +1492,7 @@ - [ ] create_client_vpn_route - [X] create_customer_gateway - [ ] create_default_subnet -- [ ] create_default_vpc +- [X] create_default_vpc - [X] create_dhcp_options - [X] create_egress_only_internet_gateway - [ ] create_fleet @@ -2858,7 +2867,7 @@ ## greengrass
-2% implemented +17% implemented - [ ] associate_role_to_group - [ ] associate_service_role_to_account @@ -2867,8 +2876,8 @@ - [X] create_core_definition - [X] create_core_definition_version - [ ] create_deployment -- [ ] create_device_definition -- [ ] create_device_definition_version +- [X] create_device_definition +- [X] create_device_definition_version - [ ] create_function_definition - [ ] create_function_definition_version - [ ] create_group @@ -2882,8 +2891,8 @@ - [ ] create_subscription_definition - [ ] create_subscription_definition_version - [ ] delete_connector_definition -- [ ] delete_core_definition -- [ ] delete_device_definition +- [X] delete_core_definition +- [X] delete_device_definition - [ ] delete_function_definition - [ ] delete_group - [ ] delete_logger_definition @@ -2896,11 +2905,11 @@ - [ ] get_connectivity_info - [ ] get_connector_definition - [ ] get_connector_definition_version -- [ ] get_core_definition -- [ ] get_core_definition_version +- [X] get_core_definition +- [X] get_core_definition_version - [ ] get_deployment_status -- [ ] get_device_definition -- [ ] get_device_definition_version +- [X] get_device_definition +- [X] get_device_definition_version - [ ] get_function_definition - [ ] get_function_definition_version - [ ] get_group @@ -2919,11 +2928,11 @@ - [ ] list_bulk_deployments - [ ] list_connector_definition_versions - [ ] list_connector_definitions -- [ ] list_core_definition_versions -- [ ] list_core_definitions +- [X] list_core_definition_versions +- [X] list_core_definitions - [ ] list_deployments -- [ ] list_device_definition_versions -- [ ] list_device_definitions +- [X] list_device_definition_versions +- [X] list_device_definitions - [ ] list_function_definition_versions - [ ] list_function_definitions - [ ] list_group_certificate_authorities @@ -2943,8 +2952,8 @@ - [ ] untag_resource - [ ] update_connectivity_info - [ ] update_connector_definition -- [ ] update_core_definition -- [ ] update_device_definition +- [X] update_core_definition +- [X] update_device_definition - [ ] update_function_definition - [ ] update_group - [ ] update_group_certificate_configuration @@ -4570,6 +4579,7 @@ - [ ] enable_logging - [X] enable_snapshot_copy - [X] get_cluster_credentials +- [ ] get_cluster_credentials_with_iam - [ ] get_reserved_node_exchange_configuration_options - [ ] get_reserved_node_exchange_offerings - [ ] modify_aqua_configuration @@ -4723,7 +4733,7 @@ ## route53
-31% implemented +34% implemented - [ ] activate_key_signing_key - [ ] associate_vpc_with_hosted_zone @@ -4756,9 +4766,9 @@ - [ ] get_account_limit - [ ] get_change - [ ] get_checker_ip_ranges -- [ ] get_dnssec +- [X] get_dnssec - [ ] get_geo_location -- [ ] get_health_check +- [X] get_health_check - [ ] get_health_check_count - [ ] get_health_check_last_failure_reason - [ ] get_health_check_status @@ -5657,7 +5667,7 @@ ## sso-admin
-9% implemented +25% implemented - [ ] attach_managed_policy_to_permission_set - [X] create_account_assignment @@ -6059,6 +6069,7 @@ - lookoutequipment - lookoutmetrics - lookoutvision +- m2 - machinelearning - macie - macie2 diff --git a/docs/docs/configuration/state_transition/models.rst b/docs/docs/configuration/state_transition/models.rst index 965557f66..bafbb1be9 100644 --- a/docs/docs/configuration/state_transition/models.rst +++ b/docs/docs/configuration/state_transition/models.rst @@ -57,7 +57,7 @@ Advancement: Call `boto3.client("dax").describe_clusters(..)`. Service: S3 (Glacier Restoration) ---------------- +----------------------------------- **Model**: `s3::keyrestore` :raw-html:`
` Available States: diff --git a/docs/docs/contributing/installation.rst b/docs/docs/contributing/installation.rst index 9dcc83250..3b516ab03 100644 --- a/docs/docs/contributing/installation.rst +++ b/docs/docs/contributing/installation.rst @@ -1,7 +1,7 @@ .. _contributing installation: ============================= -Installation +Development Installation ============================= This is a guide how to install Moto for contributors. diff --git a/docs/docs/services/dms.rst b/docs/docs/services/dms.rst index 5141d018c..6a617d723 100644 --- a/docs/docs/services/dms.rst +++ b/docs/docs/services/dms.rst @@ -30,6 +30,7 @@ dms - [ ] cancel_replication_task_assessment_run - [ ] create_endpoint - [ ] create_event_subscription +- [ ] create_fleet_advisor_collector - [ ] create_replication_instance - [ ] create_replication_subnet_group - [X] create_replication_task @@ -42,6 +43,8 @@ dms - [ ] delete_connection - [ ] delete_endpoint - [ ] delete_event_subscription +- [ ] delete_fleet_advisor_collector +- [ ] delete_fleet_advisor_databases - [ ] delete_replication_instance - [ ] delete_replication_subnet_group - [X] delete_replication_task @@ -56,6 +59,11 @@ dms - [ ] describe_event_categories - [ ] describe_event_subscriptions - [ ] describe_events +- [ ] describe_fleet_advisor_collectors +- [ ] describe_fleet_advisor_databases +- [ ] describe_fleet_advisor_lsa_analysis +- [ ] describe_fleet_advisor_schema_object_summary +- [ ] describe_fleet_advisor_schemas - [ ] describe_orderable_replication_instances - [ ] describe_pending_maintenance_actions - [ ] describe_refresh_schemas_status @@ -84,6 +92,7 @@ dms - [ ] refresh_schemas - [ ] reload_tables - [ ] remove_tags_from_resource +- [ ] run_fleet_advisor_lsa_analysis - [X] start_replication_task The following parameters have not yet been implemented: diff --git a/docs/docs/services/ec2.rst b/docs/docs/services/ec2.rst index 060ae770d..71cccee9a 100644 --- a/docs/docs/services/ec2.rst +++ b/docs/docs/services/ec2.rst @@ -81,7 +81,7 @@ ec2 - [ ] create_client_vpn_route - [X] create_customer_gateway - [ ] create_default_subnet -- [ ] create_default_vpc +- [X] create_default_vpc - [X] create_dhcp_options - [X] create_egress_only_internet_gateway - [ ] create_fleet diff --git a/docs/docs/services/greengrass.rst b/docs/docs/services/greengrass.rst index e72c211ff..315fdc543 100644 --- a/docs/docs/services/greengrass.rst +++ b/docs/docs/services/greengrass.rst @@ -32,8 +32,8 @@ greengrass - [X] create_core_definition - [X] create_core_definition_version - [ ] create_deployment -- [ ] create_device_definition -- [ ] create_device_definition_version +- [X] create_device_definition +- [X] create_device_definition_version - [ ] create_function_definition - [ ] create_function_definition_version - [ ] create_group @@ -47,8 +47,8 @@ greengrass - [ ] create_subscription_definition - [ ] create_subscription_definition_version - [ ] delete_connector_definition -- [ ] delete_core_definition -- [ ] delete_device_definition +- [X] delete_core_definition +- [X] delete_device_definition - [ ] delete_function_definition - [ ] delete_group - [ ] delete_logger_definition @@ -61,11 +61,11 @@ greengrass - [ ] get_connectivity_info - [ ] get_connector_definition - [ ] get_connector_definition_version -- [ ] get_core_definition -- [ ] get_core_definition_version +- [X] get_core_definition +- [X] get_core_definition_version - [ ] get_deployment_status -- [ ] get_device_definition -- [ ] get_device_definition_version +- [X] get_device_definition +- [X] get_device_definition_version - [ ] get_function_definition - [ ] get_function_definition_version - [ ] get_group @@ -84,11 +84,11 @@ greengrass - [ ] list_bulk_deployments - [ ] list_connector_definition_versions - [ ] list_connector_definitions -- [ ] list_core_definition_versions -- [ ] list_core_definitions +- [X] list_core_definition_versions +- [X] list_core_definitions - [ ] list_deployments -- [ ] list_device_definition_versions -- [ ] list_device_definitions +- [X] list_device_definition_versions +- [X] list_device_definitions - [ ] list_function_definition_versions - [ ] list_function_definitions - [ ] list_group_certificate_authorities @@ -108,8 +108,8 @@ greengrass - [ ] untag_resource - [ ] update_connectivity_info - [ ] update_connector_definition -- [ ] update_core_definition -- [ ] update_device_definition +- [X] update_core_definition +- [X] update_device_definition - [ ] update_function_definition - [ ] update_group - [ ] update_group_certificate_configuration diff --git a/docs/docs/services/redshift.rst b/docs/docs/services/redshift.rst index 64c3f5bc0..41b9c4b7d 100644 --- a/docs/docs/services/redshift.rst +++ b/docs/docs/services/redshift.rst @@ -111,6 +111,7 @@ redshift - [ ] enable_logging - [X] enable_snapshot_copy - [X] get_cluster_credentials +- [ ] get_cluster_credentials_with_iam - [ ] get_reserved_node_exchange_configuration_options - [ ] get_reserved_node_exchange_offerings - [ ] modify_aqua_configuration diff --git a/docs/docs/services/route53.rst b/docs/docs/services/route53.rst index 653dc587f..d00b7bf97 100644 --- a/docs/docs/services/route53.rst +++ b/docs/docs/services/route53.rst @@ -60,9 +60,9 @@ route53 - [ ] get_account_limit - [ ] get_change - [ ] get_checker_ip_ranges -- [ ] get_dnssec +- [X] get_dnssec - [ ] get_geo_location -- [ ] get_health_check +- [X] get_health_check - [ ] get_health_check_count - [ ] get_health_check_last_failure_reason - [ ] get_health_check_status diff --git a/docs/docs/services/sso-admin.rst b/docs/docs/services/sso-admin.rst index 4aa6346b8..f241125df 100644 --- a/docs/docs/services/sso-admin.rst +++ b/docs/docs/services/sso-admin.rst @@ -30,15 +30,15 @@ sso-admin - [ ] attach_managed_policy_to_permission_set - [X] create_account_assignment - [ ] create_instance_access_control_attribute_configuration -- [ ] create_permission_set +- [X] create_permission_set - [X] delete_account_assignment - [ ] delete_inline_policy_from_permission_set - [ ] delete_instance_access_control_attribute_configuration -- [ ] delete_permission_set +- [X] delete_permission_set - [ ] describe_account_assignment_creation_status - [ ] describe_account_assignment_deletion_status - [ ] describe_instance_access_control_attribute_configuration -- [ ] describe_permission_set +- [X] describe_permission_set - [ ] describe_permission_set_provisioning_status - [ ] detach_managed_policy_from_permission_set - [ ] get_inline_policy_for_permission_set @@ -53,7 +53,7 @@ sso-admin - [ ] list_instances - [ ] list_managed_policies_in_permission_set - [ ] list_permission_set_provisioning_status -- [ ] list_permission_sets +- [X] list_permission_sets - [ ] list_permission_sets_provisioned_to_account - [ ] list_tags_for_resource - [ ] provision_permission_set @@ -61,5 +61,5 @@ sso-admin - [ ] tag_resource - [ ] untag_resource - [ ] update_instance_access_control_attribute_configuration -- [ ] update_permission_set +- [X] update_permission_set diff --git a/moto/route53/urls.py b/moto/route53/urls.py index 630e25cd6..0a5b85eb0 100644 --- a/moto/route53/urls.py +++ b/moto/route53/urls.py @@ -20,7 +20,7 @@ url_paths = { r"{0}/(?P[\d_-]+)/hostedzonesbyname": Route53().list_hosted_zones_by_name_response, r"{0}/(?P[\d_-]+)/hostedzonesbyvpc": Route53().list_hosted_zones_by_vpc_response, r"{0}/(?P[\d_-]+)/hostedzonecount": Route53().get_hosted_zone_count_response, - r"{0}/(?P[\d_-]+)/healthcheck": Route53().health_check_response, + r"{0}/(?P[\d_-]+)/healthcheck$": Route53().health_check_response, r"{0}/(?P[\d_-]+)/healthcheck/(?P[^/]+)$": Route53().get_or_delete_health_check_response, r"{0}/(?P[\d_-]+)/tags/healthcheck/(?P[^/]+)$": tag_response1, r"{0}/(?P[\d_-]+)/tags/hostedzone/(?P[^/]+)$": tag_response2, diff --git a/scripts/implementation_coverage.py b/scripts/implementation_coverage.py index 0fff1f881..389972cb8 100755 --- a/scripts/implementation_coverage.py +++ b/scripts/implementation_coverage.py @@ -31,7 +31,8 @@ def get_moto_implementation(service_name): return None, None backends = list(mock().backends.values()) if backends: - return backends[0], mock_name + backend = backends[0]["us-east-1"] if "us-east-1" in backends[0] else backends[0]["global"] + return backend, mock_name def get_module_name(o): diff --git a/tests/test_route53/test_route53.py b/tests/test_route53/test_route53.py index 6c531b7f0..1352ba6f8 100644 --- a/tests/test_route53/test_route53.py +++ b/tests/test_route53/test_route53.py @@ -65,6 +65,39 @@ def test_delete_hosted_zone(): res.should.have.length_of(1) +@mock_route53 +def test_delete_hosted_zone_with_change_sets(): + conn = boto3.client("route53", region_name="us-east-1") + + zone_id = conn.create_hosted_zone( + Name="testdns.aws.com.", CallerReference=str(hash("foo")) + )["HostedZone"]["Id"] + + conn.change_resource_record_sets( + HostedZoneId=zone_id, + ChangeBatch={ + "Changes": [ + { + "Action": "CREATE", + "ResourceRecordSet": { + "Name": "foo.bar.testdns.aws.com", + "Type": "A", + "ResourceRecords": [{"Value": "1.2.3.4"}], + }, + } + ] + }, + ) + + with pytest.raises(ClientError) as exc: + conn.delete_hosted_zone(Id=zone_id) + err = exc.value.response["Error"] + err["Code"].should.equal("HostedZoneNotEmpty") + err["Message"].should.equal( + "The hosted zone contains resource records that are not SOA or NS records." + ) + + @mock_route53 def test_get_hosted_zone_count_no_zones(): conn = boto3.client("route53", region_name="us-east-1") diff --git a/tests/test_route53/test_route53_boto3.py b/tests/test_route53/test_route53_boto3.py index ec13f5fbc..5db1618d1 100644 --- a/tests/test_route53/test_route53_boto3.py +++ b/tests/test_route53/test_route53_boto3.py @@ -1,5 +1,7 @@ import boto3 +import pytest import sure # noqa # pylint: disable=unused-import +from botocore.exceptions import ClientError from moto import mock_route53 @@ -167,3 +169,45 @@ def test_create_calculated_health_check_with_children(): config.should.have.key("ChildHealthChecks").being.equal( [child1["HealthCheck"]["Id"], child2["HealthCheck"]["Id"]] ) + + +@mock_route53 +def test_get_health_check(): + client = boto3.client("route53", region_name="us-east-1") + + hc_id = client.create_health_check( + CallerReference="callref", + HealthCheckConfig={ + "Type": "CALCULATED", + "Inverted": False, + "Disabled": False, + "HealthThreshold": 1, + }, + )["HealthCheck"]["Id"] + + resp = client.get_health_check(HealthCheckId=hc_id)["HealthCheck"] + resp.should.have.key("Id").equals(hc_id) + resp.should.have.key("CallerReference").equals("callref") + resp.should.have.key("HealthCheckVersion").equals(1) + + +@mock_route53 +def test_get_unknown_health_check(): + client = boto3.client("route53", region_name="us-east-1") + + with pytest.raises(ClientError) as exc: + client.get_health_check(HealthCheckId="unknown") + err = exc.value.response["Error"] + err["Code"].should.equal("NoSuchHealthCheck") + err["Message"].should.equal("A health check with id unknown does not exist.") + + +@mock_route53 +def test_get_dns_sec(): + client = boto3.client("route53", region_name="us-east-1") + + hosted_zone_id = client.create_hosted_zone( + Name="testdns.aws.com.", CallerReference=str(hash("foo")) + )["HostedZone"]["Id"] + dns_sec = client.get_dnssec(HostedZoneId=hosted_zone_id) + dns_sec.should.have.key("Status").equals({"ServeSignature": "NOT_SIGNING"}) diff --git a/tests/test_route53/test_route53_delegationsets.py b/tests/test_route53/test_route53_delegationsets.py index cd6692d75..0065c7cca 100644 --- a/tests/test_route53/test_route53_delegationsets.py +++ b/tests/test_route53/test_route53_delegationsets.py @@ -36,7 +36,6 @@ def test_create_reusable_delegation_set_from_hosted_zone(): Name="testdns.aws.com.", CallerReference=str(hash("foo")) ) hosted_zone_id = response["HostedZone"]["Id"] - print(response) hosted_zone_name_servers = set(response["DelegationSet"]["NameServers"]) resp = client.create_reusable_delegation_set( diff --git a/tests/test_sns/test_publishing_boto3.py b/tests/test_sns/test_publishing_boto3.py index 319eadb16..962f0e7ef 100644 --- a/tests/test_sns/test_publishing_boto3.py +++ b/tests/test_sns/test_publishing_boto3.py @@ -7,6 +7,7 @@ from freezegun import freeze_time import sure # noqa # pylint: disable=unused-import from botocore.exceptions import ClientError +from unittest import SkipTest import pytest from moto import mock_sns, mock_sqs, settings from moto.core import ACCOUNT_ID @@ -398,6 +399,9 @@ def test_publish_to_sqs_in_different_region(): @freeze_time("2013-01-01") @mock_sns def test_publish_to_http(): + if settings.TEST_SERVER_MODE: + raise SkipTest("Can't mock requests in ServerMode") + def callback(request): request.headers["Content-Type"].should.equal("text/plain; charset=UTF-8") json.loads.when.called_with(request.body.decode()).should_not.throw(Exception) @@ -418,13 +422,12 @@ def test_publish_to_http(): conn.publish(TopicArn=topic_arn, Message="my message", Subject="my subject") - if not settings.TEST_SERVER_MODE: - sns_backend = sns_backends["us-east-1"] - sns_backend.topics[topic_arn].sent_notifications.should.have.length_of(1) - notification = sns_backend.topics[topic_arn].sent_notifications[0] - _, msg, subject, _, _ = notification - msg.should.equal("my message") - subject.should.equal("my subject") + sns_backend = sns_backends["us-east-1"] + sns_backend.topics[topic_arn].sent_notifications.should.have.length_of(1) + notification = sns_backend.topics[topic_arn].sent_notifications[0] + _, msg, subject, _, _ = notification + msg.should.equal("my message") + subject.should.equal("my subject") @mock_sqs