Skip to content

Commit ad4daa0

Browse files
committed
Add integration tests for RDMA VPC and Subnet
1 parent c4a6372 commit ad4daa0

2 files changed

Lines changed: 62 additions & 0 deletions

File tree

test/integration/conftest.py

Lines changed: 23 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,
@@ -483,6 +484,28 @@ def create_vpc(test_linode_client):
483484
vpc.delete()
484485

485486

487+
@pytest.fixture(scope="session")
488+
def create_vpc_with_rdma_type(test_linode_client):
489+
client = test_linode_client
490+
label = get_test_label(length=10)
491+
492+
vpc = client.vpcs.create(
493+
label=label,
494+
region=get_region(
495+
# GPUDirect RDMA capability not available for now
496+
# test_linode_client, {Capability.vpcs, Capability.gpudirect_rdma}
497+
test_linode_client,
498+
{Capability.vpcs},
499+
),
500+
description="test description",
501+
ipv6=[{"range": "auto"}],
502+
vpc_type="rdma",
503+
)
504+
yield vpc
505+
506+
vpc.delete()
507+
508+
486509
@pytest.fixture(scope="session")
487510
def create_vpc_with_subnet(test_linode_client, create_vpc):
488511
subnet = create_vpc.subnet_create(

test/integration/models/vpc/test_vpc.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from test.integration.conftest import get_region
2+
from test.integration.helpers import get_test_label
23

34
import pytest
45

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

1517

1618
@pytest.mark.smoke
@@ -38,6 +40,8 @@ def test_get_subnet(test_linode_client, create_vpc_with_subnet):
3840
vpc.ipv6[0].range.split("::")[0]
3941
)
4042
assert loaded_subnet.id == subnet.id
43+
assert loaded_subnet.vpc_type == "regular"
44+
assert loaded_subnet.vpc_type == vpc.vpc_type
4145

4246

4347
@pytest.mark.smoke
@@ -139,3 +143,38 @@ def test_get_vpc_ipv6s(test_linode_client):
139143
assert "vpc_id" in ipv6
140144
assert isinstance(ipv6["ipv6_range"], str)
141145
assert isinstance(ipv6["ipv6_addresses"], list)
146+
147+
148+
def test_get_vpc_with_rdma_type(test_linode_client, create_vpc_with_rdma_type):
149+
vpc_rdma = create_vpc_with_rdma_type
150+
assert vpc_rdma.vpc_type == "rdma"
151+
152+
vpc = test_linode_client.load(VPC, vpc_rdma.id)
153+
assert vpc.id == vpc_rdma.id
154+
assert vpc.vpc_type == vpc_rdma.vpc_type
155+
156+
vpc = test_linode_client.vpcs(VPC.vpc_type == "rdma")[0]
157+
assert vpc.id == vpc_rdma.id
158+
assert vpc.vpc_type == vpc_rdma.vpc_type
159+
160+
161+
def test_get_subnet_with_rdma_type(
162+
request, test_linode_client, create_vpc_with_rdma_type
163+
):
164+
vpc_rdma = create_vpc_with_rdma_type
165+
label = get_test_label(length=10)
166+
167+
subnet_rdma = create_vpc_with_rdma_type.subnet_create(
168+
label=label,
169+
ipv4="10.0.0.0/24",
170+
)
171+
172+
# clean-up after test
173+
request.addfinalizer(subnet_rdma.delete)
174+
175+
assert subnet_rdma.vpc_type == vpc_rdma.vpc_type
176+
assert subnet_rdma.ipv6 is None
177+
178+
subnet = test_linode_client.load(VPCSubnet, subnet_rdma.id, vpc_rdma.id)
179+
assert subnet.id == subnet_rdma.id
180+
assert subnet.ipv6 is None

0 commit comments

Comments
 (0)