Skip to content

Commit 70cb258

Browse files
authored
Merge branch 'dev' into test/update_deprecated_images
2 parents 231a59d + d8bc120 commit 70cb258

File tree

4 files changed

+68
-2
lines changed

4 files changed

+68
-2
lines changed

linode_api4/objects/linode.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ class Type(Base):
269269
"vcpus": Property(),
270270
"gpus": Property(),
271271
"successor": Property(),
272+
"accelerated_devices": Property(),
272273
# type_class is populated from the 'class' attribute of the returned JSON
273274
}
274275

test/fixtures/linode_types.json

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
2-
"results": 4,
2+
"results": 5,
33
"pages": 1,
44
"page": 1,
55
"data": [
66
{
7+
"accelerated_devices": 0,
78
"disk": 20480,
89
"memory": 1024,
910
"transfer": 1000,
@@ -52,6 +53,7 @@
5253
"successor": null
5354
},
5455
{
56+
"accelerated_devices": 0,
5557
"disk": 20480,
5658
"memory": 16384,
5759
"transfer": 5000,
@@ -100,6 +102,7 @@
100102
"successor": null
101103
},
102104
{
105+
"accelerated_devices": 0,
103106
"disk": 30720,
104107
"memory": 2048,
105108
"transfer": 2000,
@@ -148,6 +151,7 @@
148151
"successor": null
149152
},
150153
{
154+
"accelerated_devices": 0,
151155
"disk": 49152,
152156
"memory": 4096,
153157
"transfer": 3000,
@@ -194,6 +198,33 @@
194198
}
195199
],
196200
"successor": null
201+
},
202+
{
203+
"id": "g1-accelerated-netint-vpu-t1u1-m",
204+
"label": "Netint Quadra T1U x1 Medium",
205+
"price": {
206+
"hourly": 0.0,
207+
"monthly": 0.0
208+
},
209+
"region_prices": [],
210+
"addons": {
211+
"backups": {
212+
"price": {
213+
"hourly": 0.0,
214+
"monthly": 0.0
215+
},
216+
"region_prices": []
217+
}
218+
},
219+
"memory": 24576,
220+
"disk": 307200,
221+
"transfer": 0,
222+
"vcpus": 12,
223+
"gpus": 0,
224+
"network_out": 16000,
225+
"class": "accelerated",
226+
"successor": null,
227+
"accelerated_devices": 1
197228
}
198229
]
199230
}

test/integration/models/linode/test_linode.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,26 @@ def linode_for_network_interface_tests(test_linode_client, e2e_test_firewall):
8686
linode_instance.delete()
8787

8888

89+
@pytest.fixture(scope="session")
90+
def linode_for_vpu_tests(test_linode_client, e2e_test_firewall):
91+
client = test_linode_client
92+
region = "us-lax"
93+
94+
label = get_test_label(length=8)
95+
96+
linode_instance, password = client.linode.instance_create(
97+
"g1-accelerated-netint-vpu-t1u1-s",
98+
region,
99+
image="linode/debian12",
100+
label=label,
101+
firewall=e2e_test_firewall,
102+
)
103+
104+
yield linode_instance
105+
106+
linode_instance.delete()
107+
108+
89109
@pytest.fixture
90110
def linode_for_disk_tests(test_linode_client, e2e_test_firewall):
91111
client = test_linode_client
@@ -196,6 +216,13 @@ def test_get_linode(test_linode_client, linode_with_volume_firewall):
196216
assert linode.id == linode_with_volume_firewall.id
197217

198218

219+
def test_get_vpu(test_linode_client, linode_for_vpu_tests):
220+
linode = test_linode_client.load(Instance, linode_for_vpu_tests.id)
221+
222+
assert linode.label == linode_for_vpu_tests.label
223+
assert hasattr(linode.specs, "accelerated_devices")
224+
225+
199226
def test_linode_transfer(test_linode_client, linode_with_volume_firewall):
200227
linode = test_linode_client.load(Instance, linode_with_volume_firewall.id)
201228

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

621+
for linode_type in types:
622+
assert hasattr(linode_type, "accelerated_devices")
623+
594624

595625
def test_get_linode_types_overrides(test_linode_client):
596626
types = test_linode_client.linode.types()
@@ -691,6 +721,9 @@ def test_create_vlan(self, linode_for_network_interface_tests):
691721
assert interface.label == "testvlan"
692722
assert interface.ipam_address == "10.0.0.2/32"
693723

724+
def test_create_vpu(self, test_linode_client, linode_for_vpu_tests):
725+
assert hasattr(linode_for_vpu_tests.specs, "accelerated_devices")
726+
694727
def test_create_vpc(
695728
self,
696729
test_linode_client,

test/unit/objects/linode_test.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ def test_get_types(self):
656656
"""
657657
types = self.client.linode.types()
658658

659-
self.assertEqual(len(types), 4)
659+
self.assertEqual(len(types), 5)
660660
for t in types:
661661
self.assertTrue(t._populated)
662662
self.assertIsNotNone(t.id)
@@ -667,6 +667,7 @@ def test_get_types(self):
667667
self.assertIsNone(t.successor)
668668
self.assertIsNotNone(t.region_prices)
669669
self.assertIsNotNone(t.addons.backups.region_prices)
670+
self.assertIsNotNone(t.accelerated_devices)
670671

671672
def test_get_type_by_id(self):
672673
"""

0 commit comments

Comments
 (0)