From 0d837bf56be9a62908138cd5e94e6538ffede0e1 Mon Sep 17 00:00:00 2001 From: Maciej Wilk Date: Tue, 20 Oct 2026 14:17:00 +0200 Subject: [PATCH 01/11] Create Capability class and replace hardcoded str values --- tests/integration/cli/test_args.py | 5 +- tests/integration/conftest.py | 5 +- tests/integration/helpers.py | 91 +++++++++++++++++++- tests/integration/linodes/fixtures.py | 17 +++- tests/integration/linodes/test_linodes.py | 16 +++- tests/integration/lke/fixtures.py | 5 +- tests/integration/lke/test_clusters.py | 11 +-- tests/integration/lke/test_lke_enterprise.py | 6 +- tests/integration/ssh/test_plugin_ssh.py | 5 +- tests/integration/vpc/conftest.py | 22 +++-- tests/integration/vpc/test_vpc.py | 18 +++- 11 files changed, 172 insertions(+), 29 deletions(-) diff --git a/tests/integration/cli/test_args.py b/tests/integration/cli/test_args.py index 6d4ecc969..2e416be38 100644 --- a/tests/integration/cli/test_args.py +++ b/tests/integration/cli/test_args.py @@ -2,6 +2,7 @@ from linodecli.exit_codes import ExitCodes from tests.integration.helpers import ( + Capability, exec_failing_test_command, exec_test_command, get_random_region_with_caps, @@ -11,7 +12,7 @@ def test_arg_raw_body(): label = get_random_text(12) - region = get_random_region_with_caps(["VPCs"]) + region = get_random_region_with_caps([Capability.VPCs]) res = json.loads( exec_test_command( @@ -40,7 +41,7 @@ def test_arg_raw_body(): def test_arg_raw_body_conflict(): label = get_random_text(12) - region = get_random_region_with_caps(["VPCs"]) + region = get_random_region_with_caps([Capability.VPCs]) res = exec_failing_test_command( [ diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index dde6f9e6d..64e7d9ee0 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -18,6 +18,7 @@ from linodecli import ENV_TOKEN_NAME from tests.integration.helpers import ( + Capability, DEFAULT_REGION, check_attribute_value, delete_target_id, @@ -215,7 +216,9 @@ def create_vpc_w_subnet(): See: https://github.com/pytest-dev/pytest/issues/1216 """ - region = get_random_region_with_caps(required_capabilities=["VPCs"]) + region = get_random_region_with_caps( + required_capabilities=[Capability.VPCs] + ) vpc_label = get_random_text(5) + "label" subnet_label = get_random_text(5) + "label" diff --git a/tests/integration/helpers.py b/tests/integration/helpers.py index a1ba7d6ef..cdc50b28e 100644 --- a/tests/integration/helpers.py +++ b/tests/integration/helpers.py @@ -4,6 +4,7 @@ import re import subprocess import time +from enum import Enum from string import ascii_lowercase from typing import Callable, Container, Iterable, List, TypeVar @@ -64,6 +65,93 @@ BASE_CMDS = {module: ["linode-cli", module] for module in MODULES} +class StrEnum(str, Enum): + """ + Used for enums that are of type string. + + This class is a compatibility workaround for older Python versions + where built-in enum.StrEnum is not available yet + + NOTE: Replace this with StrEnum once Python 3.10 has been EOL'd. + See: https://docs.python.org/3/library/enum.html#enum.StrEnum + """ + + def __new__(cls, *values): + value = str(*values) + member = str.__new__(cls, value) + member._value_ = value + return member + + def __str__(self): + return self._value_ + + +class Capability(StrEnum): + """ + An enum class that represents the capabilities that Linode offers + across different regions and services. + + These capabilities indicate what services are available in each data center. + """ + + Linodes = "Linodes" + NodeBalancers = "NodeBalancers" + BlockStorage = "Block Storage" + ObjectStorage = "Object Storage" + ObjectStorageRegions = "Object Storage Access Key Regions" + ObjectStorageEndpointTypes = "Object Storage Endpoint Types" + Kubernetes = "Kubernetes" + LKEHAControlPlanes = "LKE HA Control Planes" + KubernetesEnterprise = "Kubernetes Enterprise" + CloudFirewall = "Cloud Firewall" + GPULinodes = "GPU Linodes" + VLANs = "Vlans" + VPCs = "VPCs" + VPCsExtra = "VPCs Extra" + MachineImages = "Machine Images" + ManagedDatabases = "Managed Databases" + ManagedDatabasesBeta = "Managed Databases Beta" + BlockStorageMigrations = "Block Storage Migrations" + Metadata = "Metadata" + PremiumPlans = "Premium Plans" + EdgePlans = "Edge Plans" + DistributedPlans = "Distributed Plans" + LKEControlPlaneACL = "LKE Network Access Control List (IP ACL)" + AkamaiCloudLoadBalancer = "Akamai Cloud Load Balancer" + SupportTicketSeverity = "Support Ticket Severity" + SupportLiveChat = "Support Live Chat" + Backups = "Backups" + PlacementGroup = "Placement Group" + DiskEncryption = "Disk Encryption" + LADiskEncryption = "LA Disk Encryption" + AkamaiRAMProtection = "Akamai RAM Protection" + BlockStorageEncryption = "Block Storage Encryption" + BlockStoragePerformanceB1 = "Block Storage Performance B1" + BlockStoragePerformanceB1Default = "Block Storage Performance B1 Default" + AkamaiCloudPulse = "Akamai Cloud Pulse" + AkamaiCloudPulseLogs = "Akamai Cloud Pulse Logs" + AkamaiCloudPulseLogsLKEEAudit = "Akamai Cloud Pulse Logs LKE-E Audit" + ACLPLogsDatacenterLKEE = "ACLP Logs Datacenter LKE-E" + SMTPEnabled = "SMTP Enabled" + StackScripts = "StackScripts" + NETINTQuadraT1U = "NETINT Quadra T1U" + LinodeInterfaces = "Linode Interfaces" + MaintenancePolicy = "Maintenance Policy" + VPCDualStack = "VPC Dual Stack" + VPCIPv6Stack = "VPC IPv6 Stack" + CustomVPCIPv4Ranges = "Custom VPC IPv4 Ranges" + NetworkLoadBalancer = "Network LoadBalancer" + NATGateway = "NAT Gateway" + KubernetesEnterpriseBYOVPC = "Kubernetes Enterprise BYO VPC" + KubernetesEnterpriseDualStack = "Kubernetes Enterprise Dual Stack" + CloudFirewallRuleSet = "Cloud Firewall Rule Set" + CloudFirewallPrefixLists = "Cloud Firewall Prefix Lists" + CloudFirewallPrefixListCurrentReferences = ( + "Cloud Firewall Prefix List Current References" + ) + GPUDirectRDMA = "GPUDirect RDMA" + + def get_random_text(length: int = 10): return "".join(random.choice(ascii_lowercase) for _ in range(length)) @@ -196,7 +284,8 @@ def retry_exec_test_command_with_delay( def get_random_region_with_caps( - required_capabilities: List[str], site_type="core" + required_capabilities: List[Capability], + site_type: str = "core" ): json_regions_data = exec_test_command( ["linode-cli", "regions", "ls", "--json"] diff --git a/tests/integration/linodes/fixtures.py b/tests/integration/linodes/fixtures.py index 8e57df9a3..6cc63d6c3 100644 --- a/tests/integration/linodes/fixtures.py +++ b/tests/integration/linodes/fixtures.py @@ -5,6 +5,7 @@ from tests.integration.helpers import ( BASE_CMDS, + Capability, DEFAULT_REGION, delete_target_id, exec_test_command, @@ -113,7 +114,7 @@ def snapshot_of_linode(): # Configs TEST_REGION = get_random_region_with_caps( - required_capabilities=["Linodes", "VPCs"] + required_capabilities=[Capability.Linodes, Capability.VPCs] ) @@ -250,7 +251,9 @@ def create_vpc_w_subnet(): # Disks @pytest.fixture(scope="module") def linode_instance_disk_tests(linode_cloud_firewall): - test_region = get_random_region_with_caps(required_capabilities=["Linodes"]) + test_region = get_random_region_with_caps( + required_capabilities=[Capability.Linodes] + ) linode_id = create_linode_and_wait( firewall_id=linode_cloud_firewall, disk_encryption=False, @@ -530,7 +533,10 @@ def linode_in_running_state_for_reboot(linode_cloud_firewall): @pytest.fixture(scope="module") def linode_for_rebuild_tests(linode_cloud_firewall): test_region = get_random_region_with_caps( - required_capabilities=["Linodes", "Disk Encryption"] + required_capabilities=[ + Capability.Linodes, + Capability.DiskEncryption, + ] ) linode_id = create_linode_and_wait( firewall_id=linode_cloud_firewall, @@ -666,7 +672,10 @@ def linode_with_label(linode_cloud_firewall): def linode_with_authorization_key(linode_cloud_firewall): label = "cli" + get_random_text(5) test_region = get_random_region_with_caps( - required_capabilities=["Linodes", "Disk Encryption"] + required_capabilities=[ + Capability.Linodes, + Capability.DiskEncryption, + ] ) result = exec_test_command( BASE_CMDS["linodes"] diff --git a/tests/integration/linodes/test_linodes.py b/tests/integration/linodes/test_linodes.py index 4bbb70bef..104038689 100644 --- a/tests/integration/linodes/test_linodes.py +++ b/tests/integration/linodes/test_linodes.py @@ -6,6 +6,7 @@ from linodecli.exit_codes import ExitCodes from tests.integration.helpers import ( BASE_CMDS, + Capability, assert_headers_in_lines, delete_target_id, exec_failing_test_command, @@ -49,7 +50,10 @@ def test_create_linodes_with_a_label(linode_with_label): def test_expected_error_if_fields_authorized_users_authorized_keys_root_pass_are_not_set(): test_region = get_random_region_with_caps( - required_capabilities=["Linodes", "Disk Encryption"] + required_capabilities=[ + Capability.Linodes, + Capability.DiskEncryption, + ] ) result = exec_failing_test_command( BASE_CMDS["linodes"] @@ -265,7 +269,10 @@ def test_disk_view(test_linode_instance): def test_create_linode_disk_encryption_enabled(linode_cloud_firewall): test_region = get_random_region_with_caps( - required_capabilities=["Linodes", "Disk Encryption"] + required_capabilities=[ + Capability.Linodes, + Capability.DiskEncryption, + ] ) linode_id = create_linode( firewall_id=linode_cloud_firewall, @@ -294,7 +301,10 @@ def test_create_linode_disk_encryption_enabled(linode_cloud_firewall): def test_create_linode_disk_encryption_disabled(linode_cloud_firewall): test_region = get_random_region_with_caps( - required_capabilities=["Linodes", "Disk Encryption"] + required_capabilities=[ + Capability.Linodes, + Capability.DiskEncryption, + ] ) linode_id = create_linode( diff --git a/tests/integration/lke/fixtures.py b/tests/integration/lke/fixtures.py index 6b2c285ad..983ae06ae 100644 --- a/tests/integration/lke/fixtures.py +++ b/tests/integration/lke/fixtures.py @@ -2,6 +2,7 @@ from tests.integration.helpers import ( BASE_CMDS, + Capability, delete_target_id, exec_test_command, get_random_region_with_caps, @@ -15,7 +16,7 @@ def lke_cluster(): label = get_random_text(8) + "_cluster" test_region = get_random_region_with_caps( - required_capabilities=["Linodes", "Kubernetes"] + required_capabilities=[Capability.Linodes, Capability.Kubernetes] ) lke_version = exec_test_command( BASE_CMDS["lke"] @@ -90,7 +91,7 @@ def lke_cluster_acl(): label = get_random_text(8) + "_cluster" test_region = get_random_region_with_caps( - required_capabilities=["Linodes", "Kubernetes"] + required_capabilities=[Capability.Linodes, Capability.Kubernetes] ) lke_version = exec_test_command( BASE_CMDS["lke"] diff --git a/tests/integration/lke/test_clusters.py b/tests/integration/lke/test_clusters.py index f19de192d..64c83b17e 100644 --- a/tests/integration/lke/test_clusters.py +++ b/tests/integration/lke/test_clusters.py @@ -4,6 +4,7 @@ from tests.integration.helpers import ( BASE_CMDS, + Capability, assert_headers_in_lines, delete_target_id, exec_test_command, @@ -25,7 +26,7 @@ def test_deploy_an_lke_cluster(): label = get_random_text(8) + "_cluster" test_region = get_random_region_with_caps( - required_capabilities=["Linodes", "Kubernetes"] + required_capabilities=[Capability.Linodes, Capability.Kubernetes] ) lke_version = exec_test_command( BASE_CMDS["lke"] @@ -393,7 +394,7 @@ def test_create_cluster_with_apl_enabled(monkeypatch): label = get_random_text(8) + "_apl_enabled_cluster" test_region = get_random_region_with_caps( - required_capabilities=["Linodes", "Kubernetes"] + required_capabilities=[Capability.Linodes, Capability.Kubernetes] ) lke_version = exec_test_command( BASE_CMDS["lke"] @@ -458,7 +459,7 @@ def test_create_cluster_with_apl_disabled(monkeypatch): label = get_random_text(8) + "_apl_disabled_cluster" test_region = get_random_region_with_caps( - required_capabilities=["Linodes", "Kubernetes"] + required_capabilities=[Capability.Linodes, Capability.Kubernetes] ) lke_version = exec_test_command( BASE_CMDS["lke"] @@ -523,7 +524,7 @@ def test_create_cluster_apl_default(monkeypatch): label = get_random_text(8) + "_apl_default_cluster" test_region = get_random_region_with_caps( - required_capabilities=["Linodes", "Kubernetes"] + required_capabilities=[Capability.Linodes, Capability.Kubernetes] ) lke_version = exec_test_command( BASE_CMDS["lke"] @@ -588,7 +589,7 @@ def test_list_clusters_includes_apl_enabled(monkeypatch): label_apl_off = get_random_text(8) + "_apl_off" test_region = get_random_region_with_caps( - required_capabilities=["Linodes", "Kubernetes"] + required_capabilities=[Capability.Linodes, Capability.Kubernetes] ) lke_version = exec_test_command( BASE_CMDS["lke"] diff --git a/tests/integration/lke/test_lke_enterprise.py b/tests/integration/lke/test_lke_enterprise.py index bcb09a3cb..faf0a2bd2 100644 --- a/tests/integration/lke/test_lke_enterprise.py +++ b/tests/integration/lke/test_lke_enterprise.py @@ -5,6 +5,7 @@ from tests.integration.helpers import ( BASE_CMDS, + Capability, assert_headers_in_lines, delete_target_id, exec_test_command, @@ -37,7 +38,10 @@ def test_create_lke_enterprise(monkeypatch: MonkeyPatch): monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta") label = get_random_text(8) test_region = get_random_region_with_caps( - required_capabilities=["Linodes", "Kubernetes Enterprise"] + required_capabilities=[ + Capability.Linodes, + Capability.KubernetesEnterprise, + ] ) k8s_version = get_lke_enterprise_id() diff --git a/tests/integration/ssh/test_plugin_ssh.py b/tests/integration/ssh/test_plugin_ssh.py index a1953fd6b..54959574f 100644 --- a/tests/integration/ssh/test_plugin_ssh.py +++ b/tests/integration/ssh/test_plugin_ssh.py @@ -6,6 +6,7 @@ from tests.integration.helpers import ( BASE_CMDS, + Capability, COMMAND_JSON_OUTPUT, delete_target_id, exec_failing_test_command, @@ -15,7 +16,9 @@ wait_for_condition, ) -TEST_REGION = get_random_region_with_caps(required_capabilities=["Linodes"]) +TEST_REGION = get_random_region_with_caps( + required_capabilities=[Capability.Linodes] +) TEST_IMAGE = "linode/arch" TEST_TYPE = "g6-nanode-1" TEST_ROOT_PASS = "r00tp@ss!long-long-and-longer" diff --git a/tests/integration/vpc/conftest.py b/tests/integration/vpc/conftest.py index 1bdef8ad7..bc7c59e4e 100644 --- a/tests/integration/vpc/conftest.py +++ b/tests/integration/vpc/conftest.py @@ -5,6 +5,7 @@ from tests.integration.conftest import create_vpc_w_subnet from tests.integration.helpers import ( BASE_CMDS, + Capability, delete_target_id, exec_test_command, get_random_region_with_caps, @@ -24,7 +25,9 @@ def get_test_vpc_w_subnet(): @pytest.fixture def get_test_vpc_wo_subnet(): - region = get_random_region_with_caps(required_capabilities=["VPCs"]) + region = get_random_region_with_caps( + required_capabilities=[Capability.VPCs] + ) label = get_random_text(5) + "-label" vpc_id = exec_test_command( @@ -51,8 +54,12 @@ def get_test_vpc_wo_subnet(): @pytest.fixture def get_test_vpc_w_rdma_type(): # GPUDirect RDMA capability not available for now - # region = get_random_region_with_caps(required_capabilities=["VPCs", "GPUDirect RDMA"]) - region = get_random_region_with_caps(required_capabilities=["VPCs"]) + # region = get_random_region_with_caps( + # required_capabilities=[Capabilities.VPCs, Capabilities.GPUDirectRDMA] + # ) + region = get_random_region_with_caps( + required_capabilities=[Capability.VPCs] + ) label = get_random_text(5) + "-test-rdma-vpc" vpc_id = exec_test_command( @@ -125,7 +132,10 @@ def create_vpc_with_ipv4(request): params = getattr(request, "param", None) params = params.split() if params else [] region = get_random_region_with_caps( - required_capabilities=["VPCs", "Custom VPC IPv4 Ranges"] + required_capabilities=[ + Capability.VPCs, + Capability.CustomVPCIPv4Ranges, + ] ) label = get_random_text(5) + "-label" @@ -146,7 +156,9 @@ def create_vpc_with_ipv6(request): ipv6_range = getattr(request, "param", None) ipv6_range = ipv6_range if ipv6_range else "auto" label = get_random_text(5) + "-vpc-label" - region = get_random_region_with_caps(required_capabilities=["VPCs"]) + region = get_random_region_with_caps( + required_capabilities=[Capability.VPCs] + ) vpc_data = json.loads( exec_test_command( diff --git a/tests/integration/vpc/test_vpc.py b/tests/integration/vpc/test_vpc.py index 4db622c92..2a1b3bfc5 100644 --- a/tests/integration/vpc/test_vpc.py +++ b/tests/integration/vpc/test_vpc.py @@ -7,6 +7,7 @@ from linodecli.exit_codes import ExitCodes from tests.integration.helpers import ( BASE_CMDS, + Capability, exec_failing_test_command, exec_test_command, get_random_region_with_caps, @@ -173,7 +174,9 @@ def test_subnet_with_rdma_type_vpc(get_test_subnet_w_rdma_type): def test_fails_to_create_vpc_invalid_label(): invalid_label = "invalid_label!?#" - region = get_random_region_with_caps(required_capabilities=["VPCs"]) + region = get_random_region_with_caps( + required_capabilities=[Capability.VPCs] + ) res = exec_failing_test_command( BASE_CMDS["vpcs"] @@ -194,7 +197,9 @@ def test_fails_to_create_vpc_duplicate_label(get_test_vpc_wo_subnet): BASE_CMDS["vpcs"] + ["view", vpc_id, "--text", "--no-headers", "--format=label"] ) - region = get_random_region_with_caps(required_capabilities=["VPCs"]) + region = get_random_region_with_caps( + required_capabilities=[Capability.VPCs] + ) res = exec_failing_test_command( BASE_CMDS["vpcs"] + ["create", "--label", label, "--region", region], @@ -337,7 +342,9 @@ def test_create_subnet_with_ipv6_auto(get_test_vpc_wo_subnet): def test_fails_to_create_vpc_with_invalid_ipv6_range(): - region = get_random_region_with_caps(required_capabilities=["VPCs"]) + region = get_random_region_with_caps( + required_capabilities=[Capability.VPCs] + ) label = get_random_text(5) + "-invalidvpc" res = exec_failing_test_command( @@ -473,7 +480,10 @@ def test_vpc_with_forbidden_ipv4_fail(): ).split()[0] region = get_random_region_with_caps( - required_capabilities=["VPCs", "Custom VPC IPv4 Ranges"] + required_capabilities=[ + Capability.VPCs, + Capability.CustomVPCIPv4Ranges, + ] ) label = get_random_text(5) + "-label" From 8d90a23a3b215e11185398345e1f9290545dbad9 Mon Sep 17 00:00:00 2001 From: Maciej Wilk Date: Tue, 3 Nov 2026 14:29:11 +0100 Subject: [PATCH 02/11] Linter --- tests/integration/conftest.py | 2 +- tests/integration/helpers.py | 3 +-- tests/integration/linodes/fixtures.py | 2 +- tests/integration/ssh/test_plugin_ssh.py | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 64e7d9ee0..1fb201bb3 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -18,8 +18,8 @@ from linodecli import ENV_TOKEN_NAME from tests.integration.helpers import ( - Capability, DEFAULT_REGION, + Capability, check_attribute_value, delete_target_id, exec_test_command, diff --git a/tests/integration/helpers.py b/tests/integration/helpers.py index ee2bd9656..94e121d7f 100644 --- a/tests/integration/helpers.py +++ b/tests/integration/helpers.py @@ -284,8 +284,7 @@ def retry_exec_test_command_with_delay( def get_random_region_with_caps( - required_capabilities: List[Capability], - site_type: str = "core" + required_capabilities: List[Capability], site_type: str = "core" ): json_regions_data = exec_test_command( ["linode-cli", "regions", "ls", "--json"] diff --git a/tests/integration/linodes/fixtures.py b/tests/integration/linodes/fixtures.py index 90e44fe83..d058d0a0c 100644 --- a/tests/integration/linodes/fixtures.py +++ b/tests/integration/linodes/fixtures.py @@ -5,8 +5,8 @@ from tests.integration.helpers import ( BASE_CMDS, - Capability, DEFAULT_REGION, + Capability, delete_target_id, exec_test_command, get_random_region_with_caps, diff --git a/tests/integration/ssh/test_plugin_ssh.py b/tests/integration/ssh/test_plugin_ssh.py index 54959574f..fbfdaca4b 100644 --- a/tests/integration/ssh/test_plugin_ssh.py +++ b/tests/integration/ssh/test_plugin_ssh.py @@ -6,8 +6,8 @@ from tests.integration.helpers import ( BASE_CMDS, - Capability, COMMAND_JSON_OUTPUT, + Capability, delete_target_id, exec_failing_test_command, exec_test_command, From 5160fec66756565e48031a75a4b3339118f78159 Mon Sep 17 00:00:00 2001 From: Maciej Wilk Date: Tue, 3 Nov 2026 14:37:36 +0100 Subject: [PATCH 03/11] Add condition for ubuntu version in CI workflow to support python 3.9 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2502a0d5a..c0140dec1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,7 +65,7 @@ jobs: echo "::error::This PR is labeled 'do-not-merge'." exit 1 unit-tests-on-ubuntu: - runs-on: ubuntu-latest + runs-on: ${{ matrix.python-version == '3.9' && 'ubuntu-24.04' || 'ubuntu-latest' }} strategy: matrix: python-version: [ "3.9","3.10","3.11", "3.12", "3.13" ] From c82145bf6b36899b1011a991eb298b7c99589b8b Mon Sep 17 00:00:00 2001 From: Maciej Wilk Date: Fri, 20 Nov 2026 15:28:09 +0100 Subject: [PATCH 04/11] Add integration tests for NAT gateways and addresses --- tests/integration/helpers.py | 1 + tests/integration/networking/fixtures.py | 60 +++++- .../integration/networking/test_networking.py | 199 ++++++++++++++++++ 3 files changed, 259 insertions(+), 1 deletion(-) diff --git a/tests/integration/helpers.py b/tests/integration/helpers.py index 94e121d7f..60ec2be92 100644 --- a/tests/integration/helpers.py +++ b/tests/integration/helpers.py @@ -47,6 +47,7 @@ "maintenance", "managed", "monitor", + "natgateways", "networking", "obj", "object-storage", diff --git a/tests/integration/networking/fixtures.py b/tests/integration/networking/fixtures.py index 723694adb..b3eb2186f 100644 --- a/tests/integration/networking/fixtures.py +++ b/tests/integration/networking/fixtures.py @@ -1,10 +1,68 @@ +import json + import pytest -from tests.integration.helpers import delete_target_id +from tests.integration.helpers import ( + BASE_CMDS, + COMMAND_JSON_OUTPUT, + Capability, + delete_target_id, + exec_test_command, + get_random_region_with_caps, +) from tests.integration.linodes.helpers import ( create_linode, create_linode_and_wait, ) +from tests.integration.linodes.fixtures import TEST_REGION # noqa: F401 + +TEST_REGION_NAT = get_random_region_with_caps( + [Capability.Linodes, Capability.NATGateway, Capability.VPCs] +) + + +@pytest.fixture +def create_nat_gateway(request, name_generator): + autoscaling = getattr(request, "param", True) + label = name_generator("nat-gateway") + result = json.loads( + exec_test_command( + BASE_CMDS["natgateways"] + + [ + "natgateways-add", + "--label", + label, + "--region", + TEST_REGION_NAT, + "--default_ports_per_interface", + "4096", + "--use_autoscaling", + str(autoscaling), + ] + + COMMAND_JSON_OUTPUT + ) + )[0] + + yield result, label + + delete_target_id("natgateways", str(result["id"]), "natgateways-delete") + + +@pytest.fixture +def create_nat_reserved_ip(request): + command = [ + "linode-cli", + "networking", + "reserved-ip-add", + "--region", + TEST_REGION_NAT, + "--json", + ] + result = json.loads(exec_test_command(command))[0] + + yield result + + delete_target_id("networking", result["address"], "reserved-ip-delete") @pytest.fixture(scope="package") diff --git a/tests/integration/networking/test_networking.py b/tests/integration/networking/test_networking.py index dae38471c..6b66ee4a8 100644 --- a/tests/integration/networking/test_networking.py +++ b/tests/integration/networking/test_networking.py @@ -7,16 +7,41 @@ from tests.integration.helpers import ( BASE_CMDS, + COMMAND_JSON_OUTPUT, DEFAULT_REGION, assert_headers_in_lines, delete_target_id, exec_test_command, ) from tests.integration.networking.fixtures import ( # noqa: F401 + TEST_REGION_NAT, + create_nat_gateway, + create_nat_reserved_ip, get_linode_id, get_linode_ids_shared_ipv4, ) +NAT_HEADERS = [ + "id", + "label", + "region", + "address_autoscale_max", + "default_ports_per_interface", + "portset_assignments", + "portset_capacity", + # "addresses", + # "vpc_subnet", +] + +NAT_ADDRESS_HEADERS = [ + "address", + "in_use", + "interface_count", + # "interface_url", + "portset_assignments", + "portset_capacity" +] + RESERVED_IP_HEADERS = [ "address", "type", @@ -33,6 +58,16 @@ ] +def assign_address_to_nat_gateway(gateway_id, address): + return json.loads( + exec_test_command( + BASE_CMDS["natgateways"] + + ["natgateways-addresses-add", "--address", address, str(gateway_id)] + + COMMAND_JSON_OUTPUT + ) + )[0] + + def has_shared_ip(linode_id: int, ip: str) -> bool: shared_ips = json.loads( exec_test_command( @@ -51,6 +86,48 @@ def has_shared_ip(linode_id: int, ip: str) -> bool: return False +def verify_nat_gateway_vals(result, label): + assert result["label"] == label + assert result["region"] == TEST_REGION_NAT + assert result["default_ports_per_interface"] == 4096 + assert result["address_autoscale_max"] >= 0 + assert result["portset_assignments"] >= 0 + assert result["portset_capacity"] >= 0 + + if result["addresses"]: + assert all(isinstance( + ipaddress.ip_address(addr["address"]), ipaddress.IPv4Address + ) for addr in result["addresses"]) + else: + assert result["addresses"] == [] + + # assert result["vpc_subnet"] is None + + +def verify_nat_gateway_address_vals(result, address): + interface_url = f"/addresses/{address}/interfaces" + + assert result["address"] == address + assert result["in_use"] == False + assert result["interface_count"] == 0 + # assert result["interface_url"].endswith(interface_url) + assert result["portset_assignments"] >= 0 + assert result["portset_capacity"] > 0 + + +def verify_nat_gateway_view_json(gateway_id, label): + result = json.loads( + exec_test_command( + BASE_CMDS["natgateways"] + + ["natgateways-view", str(gateway_id)] + + COMMAND_JSON_OUTPUT + ) + )[0] + assert_headers_in_lines(NAT_HEADERS, [list(result.keys())]) + assert result["id"] == gateway_id + verify_nat_gateway_vals(result, label) + + def verify_reserved_ip(result): assert isinstance( ipaddress.ip_address(result["address"]), ipaddress.IPv4Address @@ -402,3 +479,125 @@ def test_share_ipv4_address( ) assert not has_shared_ip(target_linode, ip_address) + + +@pytest.mark.smoke +def test_nat_gateway_create(create_nat_gateway): + gateway, label = create_nat_gateway + assert_headers_in_lines(NAT_HEADERS, [list(gateway.keys())]) + verify_nat_gateway_view_json(gateway["id"], label) + + +def test_nat_gateway_list(create_nat_gateway): + gateway, label = create_nat_gateway + result = exec_test_command( + BASE_CMDS["natgateways"] + + ["natgateways-list", "--text", "--delimiter", ","] + ).splitlines() + assert_headers_in_lines(NAT_HEADERS, result) + + result = json.loads( + exec_test_command( + BASE_CMDS["natgateways"] + + ["natgateways-list"] + + COMMAND_JSON_OUTPUT + ) + ) + matching_gateway = [ + item for item in result if item["id"] == gateway["id"] + ][0] + assert_headers_in_lines(NAT_HEADERS, [list(matching_gateway.keys())]) + verify_nat_gateway_vals(matching_gateway, label) + + +def test_nat_gateway_view(create_nat_gateway): + gateway, label = create_nat_gateway + result = exec_test_command( + BASE_CMDS["natgateways"] + + ["natgateways-view", str(gateway["id"]), "--text", "--delimiter", ","] + ).splitlines() + assert_headers_in_lines(NAT_HEADERS, result) + verify_nat_gateway_view_json(gateway["id"], label) + + +def test_nat_gateway_update(create_nat_gateway): + gateway, label = create_nat_gateway + label_new = label + "-updated" + + result = json.loads( + exec_test_command( + BASE_CMDS["natgateways"] + + ["natgateways-update", "--label", label_new, str(gateway["id"])] + + COMMAND_JSON_OUTPUT + ) + )[0] + assert_headers_in_lines(NAT_HEADERS, [list(result.keys())]) + assert result["id"] == gateway["id"] + verify_nat_gateway_view_json(gateway["id"], label_new) + + +@pytest.mark.parametrize("create_nat_gateway", [False], indirect=True) +def test_nat_gateway_address(create_nat_gateway, create_nat_reserved_ip): + gateway, label = create_nat_gateway + address = create_nat_reserved_ip["address"] + + result = assign_address_to_nat_gateway(gateway['id'], address) + assert_headers_in_lines(NAT_ADDRESS_HEADERS, [list(result.keys())]) + verify_nat_gateway_address_vals(result, address) + + exec_test_command( + BASE_CMDS["natgateways"] + + ["natgateways-address-delete", str(gateway["id"]), address] + ) + verify_nat_gateway_view_json(gateway["id"], label) + + +@pytest.mark.parametrize("create_nat_gateway", [False], indirect=True) +def test_nat_gateway_addresses_list(create_nat_gateway, create_nat_reserved_ip): + gateway, label = create_nat_gateway + address = create_nat_reserved_ip["address"] + assign_address_to_nat_gateway(gateway['id'], address) + + result = exec_test_command( + BASE_CMDS["natgateways"] + + ["natgateways-addresses-list", str(gateway["id"]), "--text", "--delimiter", ","] + ).splitlines() + assert_headers_in_lines(NAT_ADDRESS_HEADERS, result) + + result = json.loads( + exec_test_command( + BASE_CMDS["natgateways"] + + ["natgateways-addresses-list", str(gateway["id"])] + + COMMAND_JSON_OUTPUT + ) + ) + matching_address = [ + item for item in result if item["address"] == address + ][0] + assert_headers_in_lines(NAT_ADDRESS_HEADERS, [list(matching_address.keys())]) + verify_nat_gateway_address_vals(matching_address, address) + + +@pytest.mark.parametrize("create_nat_gateway", [False], indirect=True) +def test_nat_gateway_address_view(create_nat_gateway, create_nat_reserved_ip): + gateway, label = create_nat_gateway + address = create_nat_reserved_ip["address"] + assign_address_to_nat_gateway(gateway['id'], address) + + result = exec_test_command( + BASE_CMDS["natgateways"] + + ["natgateways-address-view", str(gateway["id"]), address, "--text", "--delimiter", ","] + ).splitlines() + assert_headers_in_lines(NAT_ADDRESS_HEADERS, result) + + result = json.loads( + exec_test_command( + BASE_CMDS["natgateways"] + + ["natgateways-address-view", str(gateway["id"]), address] + + COMMAND_JSON_OUTPUT + ) + )[0] + assert_headers_in_lines(NAT_ADDRESS_HEADERS, [list(result.keys())]) + verify_nat_gateway_address_vals(result, address) + verify_nat_gateway_view_json(gateway["id"], label) + From 07bc82a16881662f66949c0ea528c922b755fa8a Mon Sep 17 00:00:00 2001 From: Maciej Wilk Date: Tue, 24 Nov 2026 13:52:35 +0100 Subject: [PATCH 05/11] Extend linode's TEST_REGION with NATGateway capability and use it in NAT tests --- tests/integration/linodes/fixtures.py | 8 ++++---- tests/integration/linodes/test_linode_interfaces.py | 2 +- tests/integration/networking/fixtures.py | 10 ++-------- tests/integration/networking/test_networking.py | 8 +++++--- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/tests/integration/linodes/fixtures.py b/tests/integration/linodes/fixtures.py index d058d0a0c..e0ab238f6 100644 --- a/tests/integration/linodes/fixtures.py +++ b/tests/integration/linodes/fixtures.py @@ -114,7 +114,7 @@ def snapshot_of_linode(linode_cloud_firewall): # Configs TEST_REGION = get_random_region_with_caps( - required_capabilities=[Capability.Linodes, Capability.VPCs] + required_capabilities=[Capability.Linodes, Capability.VPCs, Capability.NATGateway] ) @@ -435,7 +435,7 @@ def linode_interface_vpc(linode_cloud_firewall): "--label", get_random_text(5) + "-vpc", "--region", - "us-sea", + TEST_REGION, "--subnets.ipv4", "10.0.0.0/24", "--subnets.label", @@ -450,7 +450,7 @@ def linode_interface_vpc(linode_cloud_firewall): linode_id = create_linode( firewall_id=linode_cloud_firewall, - test_region="us-sea", + test_region=TEST_REGION, interface_generation="linode", interfaces='[{"default_route":{"ipv4":true},"firewall_id":' + str(linode_cloud_firewall) @@ -459,7 +459,7 @@ def linode_interface_vpc(linode_cloud_firewall): + "}}]", ) - yield linode_id + yield linode_id, vpc_output[0]["id"], subnet_id delete_target_id(target="linodes", id=linode_id) delete_target_id(target="vpcs", id=str(vpc_output[0]["id"])) diff --git a/tests/integration/linodes/test_linode_interfaces.py b/tests/integration/linodes/test_linode_interfaces.py index ca861750a..f02bf33db 100644 --- a/tests/integration/linodes/test_linode_interfaces.py +++ b/tests/integration/linodes/test_linode_interfaces.py @@ -216,7 +216,7 @@ def test_interface_update(linode_interface_public, monkeypatch: MonkeyPatch): def test_interface_view(linode_interface_vpc, monkeypatch: MonkeyPatch): monkeypatch.setenv("LINODE_CLI_API_VERSION", "v4beta") - linode_id = linode_interface_vpc + linode_id, _, _ = linode_interface_vpc interface_id = get_interface_id(linode_id) data = json.loads( diff --git a/tests/integration/networking/fixtures.py b/tests/integration/networking/fixtures.py index b3eb2186f..c0e149ad2 100644 --- a/tests/integration/networking/fixtures.py +++ b/tests/integration/networking/fixtures.py @@ -5,10 +5,8 @@ from tests.integration.helpers import ( BASE_CMDS, COMMAND_JSON_OUTPUT, - Capability, delete_target_id, exec_test_command, - get_random_region_with_caps, ) from tests.integration.linodes.helpers import ( create_linode, @@ -16,10 +14,6 @@ ) from tests.integration.linodes.fixtures import TEST_REGION # noqa: F401 -TEST_REGION_NAT = get_random_region_with_caps( - [Capability.Linodes, Capability.NATGateway, Capability.VPCs] -) - @pytest.fixture def create_nat_gateway(request, name_generator): @@ -33,7 +27,7 @@ def create_nat_gateway(request, name_generator): "--label", label, "--region", - TEST_REGION_NAT, + TEST_REGION, "--default_ports_per_interface", "4096", "--use_autoscaling", @@ -55,7 +49,7 @@ def create_nat_reserved_ip(request): "networking", "reserved-ip-add", "--region", - TEST_REGION_NAT, + TEST_REGION, "--json", ] result = json.loads(exec_test_command(command))[0] diff --git a/tests/integration/networking/test_networking.py b/tests/integration/networking/test_networking.py index 6b66ee4a8..b424e76d3 100644 --- a/tests/integration/networking/test_networking.py +++ b/tests/integration/networking/test_networking.py @@ -13,8 +13,11 @@ delete_target_id, exec_test_command, ) +from tests.integration.linodes.fixtures import ( # noqa: F401 + TEST_REGION, + linode_interface_vpc, +) from tests.integration.networking.fixtures import ( # noqa: F401 - TEST_REGION_NAT, create_nat_gateway, create_nat_reserved_ip, get_linode_id, @@ -88,7 +91,7 @@ def has_shared_ip(linode_id: int, ip: str) -> bool: def verify_nat_gateway_vals(result, label): assert result["label"] == label - assert result["region"] == TEST_REGION_NAT + assert result["region"] == TEST_REGION assert result["default_ports_per_interface"] == 4096 assert result["address_autoscale_max"] >= 0 assert result["portset_assignments"] >= 0 @@ -600,4 +603,3 @@ def test_nat_gateway_address_view(create_nat_gateway, create_nat_reserved_ip): assert_headers_in_lines(NAT_ADDRESS_HEADERS, [list(result.keys())]) verify_nat_gateway_address_vals(result, address) verify_nat_gateway_view_json(gateway["id"], label) - From 2151057b7f087ffab627541baf17a0ec04b69fcd Mon Sep 17 00:00:00 2001 From: Maciej Wilk Date: Tue, 24 Nov 2026 15:10:19 +0100 Subject: [PATCH 06/11] Add test for NAT Gateway interfaces --- .../integration/networking/test_networking.py | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/tests/integration/networking/test_networking.py b/tests/integration/networking/test_networking.py index b424e76d3..df2d9ead9 100644 --- a/tests/integration/networking/test_networking.py +++ b/tests/integration/networking/test_networking.py @@ -603,3 +603,57 @@ def test_nat_gateway_address_view(create_nat_gateway, create_nat_reserved_ip): assert_headers_in_lines(NAT_ADDRESS_HEADERS, [list(result.keys())]) verify_nat_gateway_address_vals(result, address) verify_nat_gateway_view_json(gateway["id"], label) + + +@pytest.mark.skip(reason="Skipped due to subnet-update issue") +@pytest.mark.parametrize("create_nat_gateway", [False], indirect=True) +def test_nat_gateway_interfaces_list( + create_nat_gateway, + create_nat_reserved_ip, + linode_interface_vpc +): + headers = ["id", "linode", "addresses", "portsets"] + gateway, label = create_nat_gateway + address = create_nat_reserved_ip["address"] + linode_id, vpc_id, subnet_id = linode_interface_vpc + + assign_address_to_nat_gateway(gateway['id'], address) + + # Link the NAT Gateway to the VPC Subnet + exec_test_command( + BASE_CMDS["vpcs"] + + [ + "subnet-update", + "--natgateway", + str(gateway["id"]), + str(vpc_id), + str(subnet_id) + ] + ) + + commands = [ + ["natgateways-interfaces-list", str(gateway["id"])], + [ + "natgateways-address-interfaces-list", + str(gateway["id"]), + address, + ], + ] + + for args in commands: + command = BASE_CMDS["natgateways"] + args + result = exec_test_command( + command + ["--text", "--delimiter", ","] + ).splitlines() + assert_headers_in_lines(headers, result) + + result = json.loads( + exec_test_command(command + COMMAND_JSON_OUTPUT) + )[0] + assert_headers_in_lines(headers, [list(result.keys())]) + assert result["linode"]["id"] == linode_id + assert result["addresses"][0] == address + assert sorted(list(result["portsets"][0].keys())) == [ + "address", + "ports", + ] From 0a1f78a665f9ba36762cfdf0b533a1db82bfb282 Mon Sep 17 00:00:00 2001 From: Maciej Wilk Date: Tue, 24 Nov 2026 15:12:07 +0100 Subject: [PATCH 07/11] Add tests for NAT Gateway types and settings --- .../integration/networking/test_networking.py | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/tests/integration/networking/test_networking.py b/tests/integration/networking/test_networking.py index df2d9ead9..cb40437b2 100644 --- a/tests/integration/networking/test_networking.py +++ b/tests/integration/networking/test_networking.py @@ -657,3 +657,54 @@ def test_nat_gateway_interfaces_list( "address", "ports", ] + + + +def test_nat_gateway_types(create_nat_gateway): + headers = ["id", "label", "price"] + result = exec_test_command( + BASE_CMDS["natgateways"] + + ["natgateways-types-list", "--text", "--delimiter", ","] + ).splitlines() + assert_headers_in_lines(headers, result) + + result = json.loads( + exec_test_command( + BASE_CMDS["natgateways"] + + ["natgateways-types-list"] + + COMMAND_JSON_OUTPUT + ) + )[0] + assert_headers_in_lines(headers, [list(result.keys())]) + prices = [result["price"].get("hourly"), result["price"].get("monthly")] + assert result["id"] == "g1-natgateway" + assert result["label"] == "NAT Gateway" + assert any(price != 0 for price in prices) + + +def test_nat_gateway_settings(): + headers = [ + "allowed_ports_per_interface", + "maximum_autoscaling_addresses_per_natgateway", + "maximum_reserved_addresses_per_natgateway" + ] + result = exec_test_command( + BASE_CMDS["natgateways"] + + ["natgateways-settings-view", "--text", "--delimiter", ","] + ).splitlines() + assert_headers_in_lines(headers, result) + + result = json.loads( + exec_test_command( + BASE_CMDS["natgateways"] + + ["natgateways-settings-view"] + + COMMAND_JSON_OUTPUT + ) + )[0] + assert_headers_in_lines(headers, [list(result.keys())]) + assert all( + port in [4096, 8192, 16384] + for port in result["allowed_ports_per_interface"] + ) + assert result["maximum_autoscaling_addresses_per_natgateway"] > 0 + assert result["maximum_reserved_addresses_per_natgateway"] > 0 From 94ccf7f45b3131649ad480031acc8fba587d16ff Mon Sep 17 00:00:00 2001 From: Maciej Wilk Date: Tue, 24 Nov 2026 16:02:45 +0100 Subject: [PATCH 08/11] Revert conditional ubuntu versioning in CI workflow --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 084a036c0..0619afa76 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,7 +65,7 @@ jobs: echo "::error::This PR is labeled 'do-not-merge'." exit 1 unit-tests-on-ubuntu: - runs-on: ${{ matrix.python-version == '3.9' && 'ubuntu-24.04' || 'ubuntu-latest' }} + runs-on: ubuntu-latest strategy: matrix: python-version: [ "3.11", "3.12", "3.13", "3.14", "3.15" ] From a4a306ba055775c8e9afdfc2524a1a9cbb183473 Mon Sep 17 00:00:00 2001 From: Maciej Wilk Date: Fri, 27 Nov 2026 13:27:21 +0100 Subject: [PATCH 09/11] Adjust tests after TechDoc fixes#1 --- tests/integration/networking/test_networking.py | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/tests/integration/networking/test_networking.py b/tests/integration/networking/test_networking.py index cb40437b2..0d7c4fbef 100644 --- a/tests/integration/networking/test_networking.py +++ b/tests/integration/networking/test_networking.py @@ -605,14 +605,13 @@ def test_nat_gateway_address_view(create_nat_gateway, create_nat_reserved_ip): verify_nat_gateway_view_json(gateway["id"], label) -@pytest.mark.skip(reason="Skipped due to subnet-update issue") @pytest.mark.parametrize("create_nat_gateway", [False], indirect=True) def test_nat_gateway_interfaces_list( create_nat_gateway, create_nat_reserved_ip, linode_interface_vpc ): - headers = ["id", "linode", "addresses", "portsets"] + headers = ["id", "linode", "addresses"] gateway, label = create_nat_gateway address = create_nat_reserved_ip["address"] linode_id, vpc_id, subnet_id = linode_interface_vpc @@ -650,14 +649,9 @@ def test_nat_gateway_interfaces_list( result = json.loads( exec_test_command(command + COMMAND_JSON_OUTPUT) )[0] - assert_headers_in_lines(headers, [list(result.keys())]) - assert result["linode"]["id"] == linode_id + assert result["linode"]["id"] == int(linode_id) assert result["addresses"][0] == address - assert sorted(list(result["portsets"][0].keys())) == [ - "address", - "ports", - ] - + assert isinstance(result["portsets"], list) def test_nat_gateway_types(create_nat_gateway): From 04c022b3176942bbe94c6b188ac7676382d53be5 Mon Sep 17 00:00:00 2001 From: Maciej Wilk Date: Mon, 30 Nov 2026 11:34:22 +0100 Subject: [PATCH 10/11] Update natgateways commands after fixes#2 --- tests/integration/networking/fixtures.py | 4 +-- .../integration/networking/test_networking.py | 34 +++++++++---------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/tests/integration/networking/fixtures.py b/tests/integration/networking/fixtures.py index c0e149ad2..1ab7f9992 100644 --- a/tests/integration/networking/fixtures.py +++ b/tests/integration/networking/fixtures.py @@ -23,7 +23,7 @@ def create_nat_gateway(request, name_generator): exec_test_command( BASE_CMDS["natgateways"] + [ - "natgateways-add", + "create", "--label", label, "--region", @@ -39,7 +39,7 @@ def create_nat_gateway(request, name_generator): yield result, label - delete_target_id("natgateways", str(result["id"]), "natgateways-delete") + delete_target_id("natgateways", str(result["id"]), "delete") @pytest.fixture diff --git a/tests/integration/networking/test_networking.py b/tests/integration/networking/test_networking.py index 0d7c4fbef..5728c5e4d 100644 --- a/tests/integration/networking/test_networking.py +++ b/tests/integration/networking/test_networking.py @@ -65,7 +65,7 @@ def assign_address_to_nat_gateway(gateway_id, address): return json.loads( exec_test_command( BASE_CMDS["natgateways"] - + ["natgateways-addresses-add", "--address", address, str(gateway_id)] + + ["addresses-add", "--address", address, str(gateway_id)] + COMMAND_JSON_OUTPUT ) )[0] @@ -122,7 +122,7 @@ def verify_nat_gateway_view_json(gateway_id, label): result = json.loads( exec_test_command( BASE_CMDS["natgateways"] - + ["natgateways-view", str(gateway_id)] + + ["view", str(gateway_id)] + COMMAND_JSON_OUTPUT ) )[0] @@ -495,14 +495,14 @@ def test_nat_gateway_list(create_nat_gateway): gateway, label = create_nat_gateway result = exec_test_command( BASE_CMDS["natgateways"] - + ["natgateways-list", "--text", "--delimiter", ","] + + ["list", "--text", "--delimiter", ","] ).splitlines() assert_headers_in_lines(NAT_HEADERS, result) result = json.loads( exec_test_command( BASE_CMDS["natgateways"] - + ["natgateways-list"] + + ["list"] + COMMAND_JSON_OUTPUT ) ) @@ -517,7 +517,7 @@ def test_nat_gateway_view(create_nat_gateway): gateway, label = create_nat_gateway result = exec_test_command( BASE_CMDS["natgateways"] - + ["natgateways-view", str(gateway["id"]), "--text", "--delimiter", ","] + + ["view", str(gateway["id"]), "--text", "--delimiter", ","] ).splitlines() assert_headers_in_lines(NAT_HEADERS, result) verify_nat_gateway_view_json(gateway["id"], label) @@ -530,7 +530,7 @@ def test_nat_gateway_update(create_nat_gateway): result = json.loads( exec_test_command( BASE_CMDS["natgateways"] - + ["natgateways-update", "--label", label_new, str(gateway["id"])] + + ["update", "--label", label_new, str(gateway["id"])] + COMMAND_JSON_OUTPUT ) )[0] @@ -550,7 +550,7 @@ def test_nat_gateway_address(create_nat_gateway, create_nat_reserved_ip): exec_test_command( BASE_CMDS["natgateways"] - + ["natgateways-address-delete", str(gateway["id"]), address] + + ["address-delete", str(gateway["id"]), address] ) verify_nat_gateway_view_json(gateway["id"], label) @@ -563,14 +563,14 @@ def test_nat_gateway_addresses_list(create_nat_gateway, create_nat_reserved_ip): result = exec_test_command( BASE_CMDS["natgateways"] - + ["natgateways-addresses-list", str(gateway["id"]), "--text", "--delimiter", ","] + + ["addresses-list", str(gateway["id"]), "--text", "--delimiter", ","] ).splitlines() assert_headers_in_lines(NAT_ADDRESS_HEADERS, result) result = json.loads( exec_test_command( BASE_CMDS["natgateways"] - + ["natgateways-addresses-list", str(gateway["id"])] + + ["addresses-list", str(gateway["id"])] + COMMAND_JSON_OUTPUT ) ) @@ -589,14 +589,14 @@ def test_nat_gateway_address_view(create_nat_gateway, create_nat_reserved_ip): result = exec_test_command( BASE_CMDS["natgateways"] - + ["natgateways-address-view", str(gateway["id"]), address, "--text", "--delimiter", ","] + + ["address-view", str(gateway["id"]), address, "--text", "--delimiter", ","] ).splitlines() assert_headers_in_lines(NAT_ADDRESS_HEADERS, result) result = json.loads( exec_test_command( BASE_CMDS["natgateways"] - + ["natgateways-address-view", str(gateway["id"]), address] + + ["address-view", str(gateway["id"]), address] + COMMAND_JSON_OUTPUT ) )[0] @@ -631,9 +631,9 @@ def test_nat_gateway_interfaces_list( ) commands = [ - ["natgateways-interfaces-list", str(gateway["id"])], + ["interfaces-list", str(gateway["id"])], [ - "natgateways-address-interfaces-list", + "address-interfaces-list", str(gateway["id"]), address, ], @@ -658,14 +658,14 @@ def test_nat_gateway_types(create_nat_gateway): headers = ["id", "label", "price"] result = exec_test_command( BASE_CMDS["natgateways"] - + ["natgateways-types-list", "--text", "--delimiter", ","] + + ["types-list", "--text", "--delimiter", ","] ).splitlines() assert_headers_in_lines(headers, result) result = json.loads( exec_test_command( BASE_CMDS["natgateways"] - + ["natgateways-types-list"] + + ["types-list"] + COMMAND_JSON_OUTPUT ) )[0] @@ -684,14 +684,14 @@ def test_nat_gateway_settings(): ] result = exec_test_command( BASE_CMDS["natgateways"] - + ["natgateways-settings-view", "--text", "--delimiter", ","] + + ["settings-view", "--text", "--delimiter", ","] ).splitlines() assert_headers_in_lines(headers, result) result = json.loads( exec_test_command( BASE_CMDS["natgateways"] - + ["natgateways-settings-view"] + + ["settings-view"] + COMMAND_JSON_OUTPUT ) )[0] From 8a32f1c9b18d5289c719161fad5bcc11fe895b6a Mon Sep 17 00:00:00 2001 From: Maciej Wilk Date: Mon, 30 Nov 2026 12:46:07 +0100 Subject: [PATCH 11/11] Adjust tests after TechDoc fixes#2 --- tests/integration/linodes/fixtures.py | 2 +- tests/integration/networking/fixtures.py | 2 +- tests/integration/networking/test_networking.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/integration/linodes/fixtures.py b/tests/integration/linodes/fixtures.py index e0ab238f6..aa643aae2 100644 --- a/tests/integration/linodes/fixtures.py +++ b/tests/integration/linodes/fixtures.py @@ -424,7 +424,7 @@ def linode_interface_legacy(linode_cloud_firewall): delete_target_id(target="linodes", id=linode_id) -@pytest.fixture(scope="module") +@pytest.fixture def linode_interface_vpc(linode_cloud_firewall): vpc_output = json.loads( exec_test_command( diff --git a/tests/integration/networking/fixtures.py b/tests/integration/networking/fixtures.py index 1ab7f9992..e894bde1b 100644 --- a/tests/integration/networking/fixtures.py +++ b/tests/integration/networking/fixtures.py @@ -39,7 +39,7 @@ def create_nat_gateway(request, name_generator): yield result, label - delete_target_id("natgateways", str(result["id"]), "delete") + delete_target_id("natgateways", str(result["id"])) @pytest.fixture diff --git a/tests/integration/networking/test_networking.py b/tests/integration/networking/test_networking.py index 5728c5e4d..488736858 100644 --- a/tests/integration/networking/test_networking.py +++ b/tests/integration/networking/test_networking.py @@ -40,7 +40,7 @@ "address", "in_use", "interface_count", - # "interface_url", + "interface_url", "portset_assignments", "portset_capacity" ]