From 79a29819d561b6ce3d0b7066fcfacc8e886ce2c9 Mon Sep 17 00:00:00 2001 From: Jacob Fuss Date: Wed, 12 Jun 2024 14:29:37 -0500 Subject: [PATCH] fix: Remove ENI manual deletion --- integration/conftest.py | 33 --------------------------------- 1 file changed, 33 deletions(-) diff --git a/integration/conftest.py b/integration/conftest.py index cdf42763a..849f35e27 100644 --- a/integration/conftest.py +++ b/integration/conftest.py @@ -1,5 +1,4 @@ import logging -import time from pathlib import Path import boto3 @@ -61,29 +60,6 @@ def clean_all_integ_buckets(): clean_bucket(bucket.name, s3_client) -def _delete_unused_network_interface_by_subnet(ec2_client, subnet_id): - """Deletes unused network interface under the provided subnet""" - paginator = ec2_client.get_paginator("describe_network_interfaces") - response_iterator = paginator.paginate( - Filters=[ - {"Name": "subnet-id", "Values": [subnet_id]}, - {"Name": "status", "Values": ["available"]}, - ] - ) - network_interface_ids = [] - for page in response_iterator: - network_interface_ids += [ni["NetworkInterfaceId"] for ni in page["NetworkInterfaces"]] - - for ni_id in network_interface_ids: - try: - ec2_client.delete_network_interface(NetworkInterfaceId=ni_id) - except ClientError as e: - LOG.error("Unable to delete network interface %s", ni_id, exc_info=e) - time.sleep(0.5) - - LOG.info("Deleted %s unused network interfaces under subnet %s", len(network_interface_ids), subnet_id) - - @pytest.fixture() def setup_companion_stack_once(tmpdir_factory, get_prefix): tests_integ_dir = Path(__file__).resolve().parents[1] @@ -95,15 +71,6 @@ def setup_companion_stack_once(tmpdir_factory, get_prefix): companion_stack = Stack(stack_name, companion_stack_tempalte_path, cfn_client, output_dir) companion_stack.create_or_update(_stack_exists(stack_name)) - ec2_client = ClientProvider().ec2_client - precreated_subnet_ids = [ - resource["PhysicalResourceId"] - for resource in companion_stack.stack_resources["StackResourceSummaries"] - if resource["LogicalResourceId"].startswith("PreCreatedSubnet") - ] - for subnet_id in precreated_subnet_ids: - _delete_unused_network_interface_by_subnet(ec2_client, subnet_id) - @pytest.fixture() def get_serverless_application_repository_app():