Skip to content

Commit 8b85487

Browse files
Resolve various integration test failures (#591)
* Various test fixes to unblock upcoming release * Use dynamic label for VLAN test * oops * LA Disk Encryption -> Disk Encryption
1 parent 0c1f2b8 commit 8b85487

File tree

6 files changed

+47
-26
lines changed

6 files changed

+47
-26
lines changed

test/integration/filters/fixtures.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ def lke_cluster_instance(test_linode_client):
2323
node_type = test_linode_client.linode.types()[1] # g6-standard-1
2424
version = test_linode_client.lke.versions()[0]
2525

26-
region = get_region(
27-
test_linode_client, {"Kubernetes", "LA Disk Encryption"}
28-
)
26+
region = get_region(test_linode_client, {"Kubernetes", "Disk Encryption"})
2927

3028
node_pools = test_linode_client.lke.node_pool(node_type, 3)
3129
label = get_test_label() + "_cluster"

test/integration/models/image/test_image.py

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,46 @@
11
from io import BytesIO
2-
from test.integration.conftest import get_region, get_regions
2+
from test.integration.conftest import get_regions
33
from test.integration.helpers import get_test_label
44

55
import polling
66
import pytest
77

8+
from linode_api4 import LinodeClient
89
from linode_api4.objects import Image
910

11+
DISALLOWED_IMAGE_REGIONS = {
12+
"gb-lon",
13+
"au-mel",
14+
"sg-sin-2",
15+
"jp-tyo-3",
16+
}
17+
18+
19+
def get_image_upload_regions(client: LinodeClient):
20+
"""
21+
This is necessary because the API does not currently expose
22+
a capability for regions that allow custom image uploads.
23+
24+
In the future, we should remove this if the API exposes a custom images capability or
25+
if all Object Storage regions support custom images.
26+
"""
27+
28+
return [
29+
region
30+
for region in get_regions(
31+
client,
32+
capabilities={"Linodes", "Object Storage"},
33+
site_type="core",
34+
)
35+
if region.id not in DISALLOWED_IMAGE_REGIONS
36+
]
37+
1038

1139
@pytest.fixture(scope="session")
1240
def image_upload_url(test_linode_client):
1341
label = get_test_label() + "_image"
1442

15-
region = get_region(
16-
test_linode_client,
17-
capabilities={"Linodes", "Object Storage"},
18-
site_type="core",
19-
)
43+
region = get_image_upload_regions(test_linode_client)[0]
2044

2145
test_linode_client.image_create_upload(
2246
label, region.id, "integration test image upload"
@@ -38,9 +62,7 @@ def test_uploaded_image(test_linode_client):
3862

3963
label = get_test_label() + "_image"
4064

41-
regions = get_regions(
42-
test_linode_client, capabilities={"Object Storage"}, site_type="core"
43-
)
65+
regions = get_image_upload_regions(test_linode_client)
4466

4567
image = test_linode_client.image_upload(
4668
label,

test/integration/models/linode/test_linode.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def create_linode_for_long_running_tests(test_linode_client, e2e_test_firewall):
180180
def linode_with_disk_encryption(test_linode_client, request):
181181
client = test_linode_client
182182

183-
target_region = get_region(client, {"LA Disk Encryption"})
183+
target_region = get_region(client, {"Disk Encryption"})
184184
label = get_test_label(length=8)
185185

186186
disk_encryption = request.param
@@ -235,7 +235,7 @@ def test_linode_transfer(test_linode_client, linode_with_volume_firewall):
235235
def test_linode_rebuild(test_linode_client):
236236
client = test_linode_client
237237

238-
region = get_region(client, {"LA Disk Encryption"})
238+
region = get_region(client, {"Disk Encryption"})
239239

240240
label = get_test_label() + "_rebuild"
241241

test/integration/models/lke/test_lke.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ def lke_cluster(test_linode_client):
3232
node_type = test_linode_client.linode.types()[1] # g6-standard-1
3333
version = test_linode_client.lke.versions()[0]
3434

35-
region = get_region(
36-
test_linode_client, {"Kubernetes", "LA Disk Encryption"}
37-
)
35+
region = get_region(test_linode_client, {"Kubernetes", "Disk Encryption"})
3836

3937
node_pools = test_linode_client.lke.node_pool(node_type, 3)
4038
label = get_test_label() + "_cluster"
@@ -117,9 +115,7 @@ def lke_cluster_with_labels_and_taints(test_linode_client):
117115
def lke_cluster_with_apl(test_linode_client):
118116
version = test_linode_client.lke.versions()[0]
119117

120-
region = get_region(
121-
test_linode_client, {"Kubernetes", "LA Disk Encryption"}
122-
)
118+
region = get_region(test_linode_client, {"Kubernetes", "Disk Encryption"})
123119

124120
# NOTE: g6-dedicated-4 is the minimum APL-compatible Linode type
125121
node_pools = test_linode_client.lke.node_pool("g6-dedicated-4", 3)
@@ -149,7 +145,7 @@ def lke_cluster_enterprise(test_linode_client):
149145
)[0]
150146

151147
region = get_region(
152-
test_linode_client, {"Kubernetes Enterprise", "LA Disk Encryption"}
148+
test_linode_client, {"Kubernetes Enterprise", "Disk Encryption"}
153149
)
154150

155151
node_pools = test_linode_client.lke.node_pool(

test/integration/models/networking/test_networking.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def test_create_and_delete_vlan(test_linode_client, linode_for_vlan_tests):
235235
config.interfaces = []
236236
config.save()
237237

238-
vlan_label = "testvlan"
238+
vlan_label = f"{get_test_label(8)}-testvlan"
239239
interface = config.interface_create_vlan(
240240
label=vlan_label, ipam_address="10.0.0.2/32"
241241
)

test/integration/models/nodebalancer/test_nodebalancer.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ def test_update_nb(test_linode_client, create_nb):
167167
create_nb.id,
168168
)
169169

170-
nb.label = "ThisNewLabel"
170+
new_label = f"{nb.label}-ThisNewLabel"
171+
172+
nb.label = new_label
171173
nb.client_udp_sess_throttle = 5
172174
nb.save()
173175

@@ -176,7 +178,7 @@ def test_update_nb(test_linode_client, create_nb):
176178
create_nb.id,
177179
)
178180

179-
assert "ThisNewLabel" == nb_updated.label
181+
assert new_label == nb_updated.label
180182
assert 5 == nb_updated.client_udp_sess_throttle
181183

182184

@@ -215,7 +217,10 @@ def test_update_nb_node(test_linode_client, create_nb_config):
215217
create_nb_config.nodebalancer_id,
216218
)
217219
node = config.nodes[0]
218-
node.label = "ThisNewLabel"
220+
221+
new_label = f"{node.label}-ThisNewLabel"
222+
223+
node.label = new_label
219224
node.weight = 50
220225
node.mode = "accept"
221226
node.save()
@@ -226,7 +231,7 @@ def test_update_nb_node(test_linode_client, create_nb_config):
226231
(create_nb_config.id, create_nb_config.nodebalancer_id),
227232
)
228233

229-
assert "ThisNewLabel" == node_updated.label
234+
assert new_label == node_updated.label
230235
assert 50 == node_updated.weight
231236
assert "accept" == node_updated.mode
232237

0 commit comments

Comments
 (0)