Skip to content

Commit f355068

Browse files
authored
fix: Remove ENI manual deletion (#3613)
Co-authored-by: Jacob Fuss <[email protected]>
1 parent bbe98a5 commit f355068

File tree

1 file changed

+0
-33
lines changed

1 file changed

+0
-33
lines changed

integration/conftest.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import logging
2-
import time
32
from pathlib import Path
43

54
import boto3
@@ -61,29 +60,6 @@ def clean_all_integ_buckets():
6160
clean_bucket(bucket.name, s3_client)
6261

6362

64-
def _delete_unused_network_interface_by_subnet(ec2_client, subnet_id):
65-
"""Deletes unused network interface under the provided subnet"""
66-
paginator = ec2_client.get_paginator("describe_network_interfaces")
67-
response_iterator = paginator.paginate(
68-
Filters=[
69-
{"Name": "subnet-id", "Values": [subnet_id]},
70-
{"Name": "status", "Values": ["available"]},
71-
]
72-
)
73-
network_interface_ids = []
74-
for page in response_iterator:
75-
network_interface_ids += [ni["NetworkInterfaceId"] for ni in page["NetworkInterfaces"]]
76-
77-
for ni_id in network_interface_ids:
78-
try:
79-
ec2_client.delete_network_interface(NetworkInterfaceId=ni_id)
80-
except ClientError as e:
81-
LOG.error("Unable to delete network interface %s", ni_id, exc_info=e)
82-
time.sleep(0.5)
83-
84-
LOG.info("Deleted %s unused network interfaces under subnet %s", len(network_interface_ids), subnet_id)
85-
86-
8763
@pytest.fixture()
8864
def setup_companion_stack_once(tmpdir_factory, get_prefix):
8965
tests_integ_dir = Path(__file__).resolve().parents[1]
@@ -95,15 +71,6 @@ def setup_companion_stack_once(tmpdir_factory, get_prefix):
9571
companion_stack = Stack(stack_name, companion_stack_tempalte_path, cfn_client, output_dir)
9672
companion_stack.create_or_update(_stack_exists(stack_name))
9773

98-
ec2_client = ClientProvider().ec2_client
99-
precreated_subnet_ids = [
100-
resource["PhysicalResourceId"]
101-
for resource in companion_stack.stack_resources["StackResourceSummaries"]
102-
if resource["LogicalResourceId"].startswith("PreCreatedSubnet")
103-
]
104-
for subnet_id in precreated_subnet_ids:
105-
_delete_unused_network_interface_by_subnet(ec2_client, subnet_id)
106-
10774

10875
@pytest.fixture()
10976
def get_serverless_application_repository_app():

0 commit comments

Comments
 (0)