Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/integration/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"maintenance",
"managed",
"monitor",
"natgateways",
"networking",
"obj",
"object-storage",
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/linodes/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
)


Expand Down Expand Up @@ -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(
Expand All @@ -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",
Expand All @@ -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)
Expand All @@ -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"]))
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/linodes/test_linode_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
54 changes: 53 additions & 1 deletion tests/integration/networking/fixtures.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,62 @@
import json

import pytest

from tests.integration.helpers import delete_target_id
from tests.integration.helpers import (
BASE_CMDS,
COMMAND_JSON_OUTPUT,
delete_target_id,
exec_test_command,
)
from tests.integration.linodes.helpers import (
create_linode,
create_linode_and_wait,
)
from tests.integration.linodes.fixtures import TEST_REGION # noqa: F401


@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"]
+ [
"create",
"--label",
label,
"--region",
TEST_REGION,
"--default_ports_per_interface",
"4096",
"--use_autoscaling",
str(autoscaling),
]
+ COMMAND_JSON_OUTPUT
)
)[0]

yield result, label

delete_target_id("natgateways", str(result["id"]))


@pytest.fixture
def create_nat_reserved_ip(request):
command = [
"linode-cli",
"networking",
"reserved-ip-add",
"--region",
TEST_REGION,
"--json",
]
result = json.loads(exec_test_command(command))[0]

yield result

delete_target_id("networking", result["address"], "reserved-ip-delete")


@pytest.fixture(scope="package")
Expand Down
Loading
Loading