Skip to content

Commit efbb64e

Browse files
authored
TPT-4602: Support NAT service int tests (#743)
* Add int tests for networking NAT Gateway endpoints * Add int tests for VPC subnet with NAT Gateway * Remove condition for NAT gateway deletion * Refactor NAT Gateway integration tests * Clean up * Add fixture for Reserved IP created in the NAT Gateway region * Add test for NAT Gateway and Reserved IP in diff regions
1 parent f2db196 commit efbb64e

3 files changed

Lines changed: 359 additions & 43 deletions

File tree

‎test/integration/conftest.py‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from requests.exceptions import ConnectionError, RequestException
1818

1919
from linode_api4 import (
20+
Capability,
2021
Instance,
2122
InterfaceGeneration,
2223
IPAddress,
@@ -815,3 +816,49 @@ def create_reserved_ip_assigned(test_linode_client, create_linode):
815816
IPAddress.address == reserved_ip.address
816817
):
817818
address[0].delete()
819+
820+
821+
@pytest.fixture
822+
def create_nat_gateway(request, test_linode_client):
823+
client = test_linode_client
824+
label = "nat-gateway-" + get_test_label(length=8)
825+
autoscaling = getattr(request, "param", True)
826+
region = get_region(
827+
client,
828+
{
829+
Capability.firewall,
830+
Capability.linodes,
831+
Capability.linode_interfaces,
832+
Capability.natgateway,
833+
Capability.vpcs,
834+
Capability.vpc_dual_stack,
835+
Capability.vpc_ipv6_stack,
836+
},
837+
)
838+
839+
gateway = client.networking.natgateway_create(
840+
label=label,
841+
region=region,
842+
use_autoscaling=autoscaling,
843+
)
844+
845+
yield gateway
846+
847+
gateway.delete()
848+
849+
850+
@pytest.fixture
851+
def create_nat_vpc(test_linode_client, create_nat_gateway):
852+
client = test_linode_client
853+
gateway = create_nat_gateway
854+
label = get_test_label(length=10)
855+
856+
vpc = client.vpcs.create(
857+
label=label,
858+
region=gateway.region,
859+
description="test NAT Gateway VPC",
860+
ipv6=[{"range": "auto"}],
861+
)
862+
yield vpc
863+
864+
vpc.delete()

0 commit comments

Comments
 (0)