Skip to content
Open
Show file tree
Hide file tree
Changes from 8 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
22 changes: 22 additions & 0 deletions test/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from requests.exceptions import ConnectionError, RequestException

from linode_api4 import (
Capability,
Instance,
InterfaceGeneration,
IPAddress,
Expand Down Expand Up @@ -483,6 +484,27 @@ def create_vpc(test_linode_client):
vpc.delete()


@pytest.fixture(scope="session")
Comment thread
mawilk90 marked this conversation as resolved.
Outdated
def create_vpc_with_rdma_type(test_linode_client):
client = test_linode_client
label = get_test_label(length=10)

vpc = client.vpcs.create(
label=label,
region=get_region(
# GPUDirect RDMA capability not available for now
# test_linode_client, {Capability.vpcs, Capability.gpudirect_rdma}
test_linode_client,
{Capability.vpcs},
),
description="test description",
vpc_type="rdma",
)
yield vpc

vpc.delete()


@pytest.fixture(scope="session")
def create_vpc_with_subnet(test_linode_client, create_vpc):
subnet = create_vpc.subnet_create(
Expand Down
40 changes: 40 additions & 0 deletions test/integration/models/vpc/test_vpc.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from test.integration.conftest import get_region
from test.integration.helpers import get_test_label

import pytest

Expand All @@ -11,6 +12,7 @@ def test_get_vpc(test_linode_client, create_vpc):
test_linode_client.vpcs()
assert vpc.id == create_vpc.id
assert isinstance(vpc.ipv6[0].range, str)
assert vpc.vpc_type == "regular"


@pytest.mark.smoke
Expand Down Expand Up @@ -38,6 +40,8 @@ def test_get_subnet(test_linode_client, create_vpc_with_subnet):
vpc.ipv6[0].range.split("::")[0]
)
assert loaded_subnet.id == subnet.id
assert loaded_subnet.vpc_type == "regular"
assert loaded_subnet.vpc_type == vpc.vpc_type


@pytest.mark.smoke
Expand Down Expand Up @@ -139,3 +143,39 @@ def test_get_vpc_ipv6s(test_linode_client):
assert "vpc_id" in ipv6
assert isinstance(ipv6["ipv6_range"], str)
assert isinstance(ipv6["ipv6_addresses"], list)


def test_get_vpc_with_rdma_type(test_linode_client, create_vpc_with_rdma_type):
vpc_rdma = create_vpc_with_rdma_type
assert vpc_rdma.vpc_type == "rdma"
assert vpc_rdma.ipv6 is None

vpc = test_linode_client.load(VPC, vpc_rdma.id)
assert vpc.id == vpc_rdma.id
assert vpc.vpc_type == vpc_rdma.vpc_type

vpc = test_linode_client.vpcs(VPC.vpc_type == "rdma")[-1]
assert vpc.id == vpc_rdma.id
assert vpc.vpc_type == vpc_rdma.vpc_type
Comment thread
mawilk90 marked this conversation as resolved.
Outdated


def test_get_subnet_with_rdma_type(
request, test_linode_client, create_vpc_with_rdma_type
):
vpc_rdma = create_vpc_with_rdma_type
label = get_test_label(length=10)

subnet_rdma = create_vpc_with_rdma_type.subnet_create(
label=label,
ipv4="10.0.0.0/24",
)

# clean-up after test
request.addfinalizer(subnet_rdma.delete)
Comment thread
mawilk90 marked this conversation as resolved.
Outdated

assert subnet_rdma.vpc_type == vpc_rdma.vpc_type
assert subnet_rdma.ipv6 is None

subnet = test_linode_client.load(VPCSubnet, subnet_rdma.id, vpc_rdma.id)
assert subnet.id == subnet_rdma.id
assert subnet.ipv6 is None