From 110cf01e8ad2e9a53d0ae236109754365fc55857 Mon Sep 17 00:00:00 2001 From: Bert Blommers Date: Thu, 10 Aug 2023 18:06:19 +0000 Subject: [PATCH] Techdebt: Revert vpc test changes (#6631) --- .../test_vpc_endpoint_services_integration.py | 40 ++----------------- ..._vpc_service_configuration_integration.py} | 33 +++++++++++++++ 2 files changed, 36 insertions(+), 37 deletions(-) rename tests/test_ec2/{test_vpc_service_configuration.py => test_vpc_service_configuration_integration.py} (92%) diff --git a/tests/test_ec2/test_vpc_endpoint_services_integration.py b/tests/test_ec2/test_vpc_endpoint_services_integration.py index 95dc4039b..3eb3b016c 100644 --- a/tests/test_ec2/test_vpc_endpoint_services_integration.py +++ b/tests/test_ec2/test_vpc_endpoint_services_integration.py @@ -1,14 +1,12 @@ """Unit tests specific to VPC endpoint services.""" -import boto3 import pytest +import boto3 from botocore.exceptions import ClientError -from unittest import SkipTest -from moto import mock_ec2, mock_elbv2, settings +from moto import mock_ec2, settings from moto.core import DEFAULT_ACCOUNT_ID as ACCOUNT_ID - -from .test_vpc_service_configuration import create_load_balancer +from unittest import SkipTest @mock_ec2 @@ -265,35 +263,3 @@ def test_describe_vpc_default_endpoint_services(): assert details["ServiceName"] == "com.amazonaws.us-west-1.config" assert details["ServiceType"] == [{"ServiceType": "Interface"}] assert details["VpcEndpointPolicySupported"] is True - - -@mock_ec2 -@mock_elbv2 -def test_create_vpc_endpoint_service_configuration_with_options(): - client = boto3.client("ec2", region_name="us-east-2") - - lb_arn = create_load_balancer( - region_name="us-east-2", lb_type="gateway", zone="us-east-1c" - ) - - config = client.create_vpc_endpoint_service_configuration( - GatewayLoadBalancerArns=[lb_arn], - AcceptanceRequired=False, - PrivateDnsName="example.com", - )["ServiceConfiguration"] - - assert config["AcceptanceRequired"] is False - assert config["PrivateDnsName"] == "example.com" - assert config["PrivateDnsNameConfiguration"] == { - "Name": "n", - "State": "verified", - "Type": "TXT", - "Value": "val", - } - - service_name = config["ServiceName"] - detail = client.describe_vpc_endpoint_services(ServiceNames=[service_name])[ - "ServiceDetails" - ][0] - assert detail["ServiceName"] == service_name - assert detail["Owner"] == ACCOUNT_ID diff --git a/tests/test_ec2/test_vpc_service_configuration.py b/tests/test_ec2/test_vpc_service_configuration_integration.py similarity index 92% rename from tests/test_ec2/test_vpc_service_configuration.py rename to tests/test_ec2/test_vpc_service_configuration_integration.py index a1f487bfe..80dd07650 100644 --- a/tests/test_ec2/test_vpc_service_configuration.py +++ b/tests/test_ec2/test_vpc_service_configuration_integration.py @@ -3,6 +3,7 @@ import pytest from botocore.exceptions import ClientError from moto import mock_ec2, mock_elbv2 +from moto.core import DEFAULT_ACCOUNT_ID from moto.moto_api._internal import mock_random # See our Development Tips on writing tests for hints on how to write good tests: @@ -92,6 +93,38 @@ def test_create_vpc_endpoint_service_configuration_with_gateway_load_balancer(): assert "NetworkLoadBalancerArns" not in config +@mock_ec2 +@mock_elbv2 +def test_create_vpc_endpoint_service_configuration_with_options(): + client = boto3.client("ec2", region_name="us-east-2") + + lb_arn = create_load_balancer( + region_name="us-east-2", lb_type="gateway", zone="us-east-1c" + ) + + config = client.create_vpc_endpoint_service_configuration( + GatewayLoadBalancerArns=[lb_arn], + AcceptanceRequired=False, + PrivateDnsName="example.com", + )["ServiceConfiguration"] + + assert config["AcceptanceRequired"] is False + assert config["PrivateDnsName"] == "example.com" + assert config["PrivateDnsNameConfiguration"] == { + "Name": "n", + "State": "verified", + "Type": "TXT", + "Value": "val", + } + + service_name = config["ServiceName"] + detail = client.describe_vpc_endpoint_services(ServiceNames=[service_name])[ + "ServiceDetails" + ][0] + assert detail["ServiceName"] == service_name + assert detail["Owner"] == DEFAULT_ACCOUNT_ID + + @mock_ec2 @mock_elbv2 def test_describe_vpc_endpoint_service_configurations():