Skip to content

Commit 89e5b3f

Browse files
Retry on 504s in integration test suite; resolve VPU availability dynamically (#727)
1 parent d212d1b commit 89e5b3f

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

test/integration/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ def test_linode_client():
286286
token,
287287
base_url=api_url,
288288
ca_path=api_ca_file,
289+
retry_statuses=[504],
289290
)
290291
return client
291292

test/integration/models/linode/test_linode.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
Type,
2424
)
2525
from linode_api4.objects.linode import InstanceDiskEncryptionType, MigrationType
26+
from linode_api4.objects.region import RegionAvailabilityEntry
2627

2728

2829
@pytest.fixture(scope="session")
@@ -119,12 +120,23 @@ def linode_and_vpc_for_legacy_interface_tests_offline(
119120
@pytest.fixture(scope="session")
120121
def linode_for_vpu_tests(test_linode_client, e2e_test_firewall):
121122
client = test_linode_client
122-
region = "us-lax"
123+
vpu_type = "g1-accelerated-netint-vpu-t1u1-s"
124+
125+
availability = client.regions.availability(
126+
RegionAvailabilityEntry.filters.plan == vpu_type
127+
)
128+
129+
region = next(
130+
(entry.region for entry in availability if entry.available), None
131+
)
132+
133+
if region is None:
134+
pytest.skip("No VPU capacity is currently available")
123135

124136
label = get_test_label(length=8)
125137

126138
linode_instance = client.linode.instance_create(
127-
"g1-accelerated-netint-vpu-t1u1-s",
139+
vpu_type,
128140
region,
129141
image="linode/debian12",
130142
label=label,

0 commit comments

Comments
 (0)