Skip to content
Merged
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 linode_api4/objects/linode.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ class Type(Base):
"vcpus": Property(),
"gpus": Property(),
"successor": Property(),
"accelerated_devices": Property(),
# type_class is populated from the 'class' attribute of the returned JSON
}

Expand Down
33 changes: 32 additions & 1 deletion test/fixtures/linode_types.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"results": 4,
"results": 5,
"pages": 1,
"page": 1,
"data": [
{
"accelerated_devices": 0,
"disk": 20480,
"memory": 1024,
"transfer": 1000,
Expand Down Expand Up @@ -52,6 +53,7 @@
"successor": null
},
{
"accelerated_devices": 0,
"disk": 20480,
"memory": 16384,
"transfer": 5000,
Expand Down Expand Up @@ -100,6 +102,7 @@
"successor": null
},
{
"accelerated_devices": 0,
"disk": 30720,
"memory": 2048,
"transfer": 2000,
Expand Down Expand Up @@ -148,6 +151,7 @@
"successor": null
},
{
"accelerated_devices": 0,
"disk": 49152,
"memory": 4096,
"transfer": 3000,
Expand Down Expand Up @@ -194,6 +198,33 @@
}
],
"successor": null
},
{
"id": "g1-accelerated-netint-vpu-t1u1-m",
"label": "Netint Quadra T1U x1 Medium",
"price": {
"hourly": 0.0,
"monthly": 0.0
},
"region_prices": [],
"addons": {
"backups": {
"price": {
"hourly": 0.0,
"monthly": 0.0
},
"region_prices": []
}
},
"memory": 24576,
"disk": 307200,
"transfer": 0,
"vcpus": 12,
"gpus": 0,
"network_out": 16000,
"class": "accelerated",
"successor": null,
"accelerated_devices": 1
}
]
}
47 changes: 40 additions & 7 deletions test/integration/models/linode/test_linode.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def linode_with_volume_firewall(test_linode_client):
linode_instance, password = client.linode.instance_create(
"g6-nanode-1",
region,
image="linode/debian10",
image="linode/debian12",
label=label + "_modlinode",
)

Expand Down Expand Up @@ -76,7 +76,27 @@ def linode_for_network_interface_tests(test_linode_client, e2e_test_firewall):
linode_instance, password = client.linode.instance_create(
"g6-nanode-1",
region,
image="linode/debian10",
image="linode/debian12",
label=label,
firewall=e2e_test_firewall,
)

yield linode_instance

linode_instance.delete()


@pytest.fixture(scope="session")
def linode_for_vpu_tests(test_linode_client, e2e_test_firewall):
client = test_linode_client
region = "us-lax"

label = get_test_label(length=8)

linode_instance, password = client.linode.instance_create(
"g1-accelerated-netint-vpu-t1u1-s",
region,
image="linode/debian12",
label=label,
firewall=e2e_test_firewall,
)
Expand Down Expand Up @@ -147,7 +167,7 @@ def create_linode_for_long_running_tests(test_linode_client, e2e_test_firewall):
linode_instance, password = client.linode.instance_create(
"g6-nanode-1",
region,
image="linode/debian10",
image="linode/debian12",
label=label + "_long_tests",
firewall=e2e_test_firewall,
)
Expand Down Expand Up @@ -196,6 +216,13 @@ def test_get_linode(test_linode_client, linode_with_volume_firewall):
assert linode.id == linode_with_volume_firewall.id


def test_get_vpu(test_linode_client, linode_for_vpu_tests):
linode = test_linode_client.load(Instance, linode_for_vpu_tests.id)

assert linode.label == linode_for_vpu_tests.label
assert hasattr(linode.specs, "accelerated_devices")


def test_linode_transfer(test_linode_client, linode_with_volume_firewall):
linode = test_linode_client.load(Instance, linode_with_volume_firewall.id)

Expand All @@ -214,22 +241,22 @@ def test_linode_rebuild(test_linode_client):
label = get_test_label() + "_rebuild"

linode, password = client.linode.instance_create(
"g6-nanode-1", region, image="linode/debian10", label=label
"g6-nanode-1", region, image="linode/debian12", label=label
)

wait_for_condition(10, 100, get_status, linode, "running")

retry_sending_request(
3,
linode.rebuild,
"linode/debian10",
"linode/debian12",
disk_encryption=InstanceDiskEncryptionType.disabled,
)

wait_for_condition(10, 100, get_status, linode, "rebuilding")

assert linode.status == "rebuilding"
assert linode.image.id == "linode/debian10"
assert linode.image.id == "linode/debian12"

assert linode.disk_encryption == InstanceDiskEncryptionType.disabled

Expand Down Expand Up @@ -272,7 +299,7 @@ def test_delete_linode(test_linode_client):
linode_instance, password = client.linode.instance_create(
"g6-nanode-1",
region,
image="linode/debian10",
image="linode/debian12",
label=label + "_linode",
)

Expand Down Expand Up @@ -591,6 +618,9 @@ def test_get_linode_types(test_linode_client):
assert len(types) > 0
assert "g6-nanode-1" in ids

for linode_type in types:
assert hasattr(linode_type, "accelerated_devices")


def test_get_linode_types_overrides(test_linode_client):
types = test_linode_client.linode.types()
Expand Down Expand Up @@ -691,6 +721,9 @@ def test_create_vlan(self, linode_for_network_interface_tests):
assert interface.label == "testvlan"
assert interface.ipam_address == "10.0.0.2/32"

def test_create_vpu(self, test_linode_client, linode_for_vpu_tests):
assert hasattr(linode_for_vpu_tests.specs, "accelerated_devices")

def test_create_vpc(
self,
test_linode_client,
Expand Down
3 changes: 2 additions & 1 deletion test/unit/objects/linode_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ def test_get_types(self):
"""
types = self.client.linode.types()

self.assertEqual(len(types), 4)
self.assertEqual(len(types), 5)
for t in types:
self.assertTrue(t._populated)
self.assertIsNotNone(t.id)
Expand All @@ -667,6 +667,7 @@ def test_get_types(self):
self.assertIsNone(t.successor)
self.assertIsNotNone(t.region_prices)
self.assertIsNotNone(t.addons.backups.region_prices)
self.assertIsNotNone(t.accelerated_devices)

def test_get_type_by_id(self):
"""
Expand Down
Loading