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
4 changes: 1 addition & 3 deletions test/integration/filters/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ def lke_cluster_instance(test_linode_client):
node_type = test_linode_client.linode.types()[1] # g6-standard-1
version = test_linode_client.lke.versions()[0]

region = get_region(
test_linode_client, {"Kubernetes", "LA Disk Encryption"}
)
region = get_region(test_linode_client, {"Kubernetes", "Disk Encryption"})

node_pools = test_linode_client.lke.node_pool(node_type, 3)
label = get_test_label() + "_cluster"
Expand Down
40 changes: 31 additions & 9 deletions test/integration/models/image/test_image.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,46 @@
from io import BytesIO
from test.integration.conftest import get_region, get_regions
from test.integration.conftest import get_regions
from test.integration.helpers import get_test_label

import polling
import pytest

from linode_api4 import LinodeClient
from linode_api4.objects import Image

DISALLOWED_IMAGE_REGIONS = {
"gb-lon",
"au-mel",
"sg-sin-2",
"jp-tyo-3",
}


def get_image_upload_regions(client: LinodeClient):
"""
This is necessary because the API does not currently expose
a capability for regions that allow custom image uploads.

In the future, we should remove this if the API exposes a custom images capability or
if all Object Storage regions support custom images.
"""

return [
region
for region in get_regions(
client,
capabilities={"Linodes", "Object Storage"},
site_type="core",
)
if region.id not in DISALLOWED_IMAGE_REGIONS
]


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

region = get_region(
test_linode_client,
capabilities={"Linodes", "Object Storage"},
site_type="core",
)
region = get_image_upload_regions(test_linode_client)[0]

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

label = get_test_label() + "_image"

regions = get_regions(
test_linode_client, capabilities={"Object Storage"}, site_type="core"
)
regions = get_image_upload_regions(test_linode_client)

image = test_linode_client.image_upload(
label,
Expand Down
4 changes: 2 additions & 2 deletions test/integration/models/linode/test_linode.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def create_linode_for_long_running_tests(test_linode_client, e2e_test_firewall):
def linode_with_disk_encryption(test_linode_client, request):
client = test_linode_client

target_region = get_region(client, {"LA Disk Encryption"})
target_region = get_region(client, {"Disk Encryption"})
label = get_test_label(length=8)

disk_encryption = request.param
Expand Down Expand Up @@ -235,7 +235,7 @@ def test_linode_transfer(test_linode_client, linode_with_volume_firewall):
def test_linode_rebuild(test_linode_client):
client = test_linode_client

region = get_region(client, {"LA Disk Encryption"})
region = get_region(client, {"Disk Encryption"})

label = get_test_label() + "_rebuild"

Expand Down
10 changes: 3 additions & 7 deletions test/integration/models/lke/test_lke.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ def lke_cluster(test_linode_client):
node_type = test_linode_client.linode.types()[1] # g6-standard-1
version = test_linode_client.lke.versions()[0]

region = get_region(
test_linode_client, {"Kubernetes", "LA Disk Encryption"}
)
region = get_region(test_linode_client, {"Kubernetes", "Disk Encryption"})

node_pools = test_linode_client.lke.node_pool(node_type, 3)
label = get_test_label() + "_cluster"
Expand Down Expand Up @@ -117,9 +115,7 @@ def lke_cluster_with_labels_and_taints(test_linode_client):
def lke_cluster_with_apl(test_linode_client):
version = test_linode_client.lke.versions()[0]

region = get_region(
test_linode_client, {"Kubernetes", "LA Disk Encryption"}
)
region = get_region(test_linode_client, {"Kubernetes", "Disk Encryption"})

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

region = get_region(
test_linode_client, {"Kubernetes Enterprise", "LA Disk Encryption"}
test_linode_client, {"Kubernetes Enterprise", "Disk Encryption"}
)

node_pools = test_linode_client.lke.node_pool(
Expand Down
2 changes: 1 addition & 1 deletion test/integration/models/networking/test_networking.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def test_create_and_delete_vlan(test_linode_client, linode_for_vlan_tests):
config.interfaces = []
config.save()

vlan_label = "testvlan"
vlan_label = f"{get_test_label(8)}-testvlan"
interface = config.interface_create_vlan(
label=vlan_label, ipam_address="10.0.0.2/32"
)
Expand Down
13 changes: 9 additions & 4 deletions test/integration/models/nodebalancer/test_nodebalancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ def test_update_nb(test_linode_client, create_nb):
create_nb.id,
)

nb.label = "ThisNewLabel"
new_label = f"{nb.label}-ThisNewLabel"

nb.label = new_label
nb.client_udp_sess_throttle = 5
nb.save()

Expand All @@ -176,7 +178,7 @@ def test_update_nb(test_linode_client, create_nb):
create_nb.id,
)

assert "ThisNewLabel" == nb_updated.label
assert new_label == nb_updated.label
assert 5 == nb_updated.client_udp_sess_throttle


Expand Down Expand Up @@ -215,7 +217,10 @@ def test_update_nb_node(test_linode_client, create_nb_config):
create_nb_config.nodebalancer_id,
)
node = config.nodes[0]
node.label = "ThisNewLabel"

new_label = f"{node.label}-ThisNewLabel"

node.label = new_label
node.weight = 50
node.mode = "accept"
node.save()
Expand All @@ -226,7 +231,7 @@ def test_update_nb_node(test_linode_client, create_nb_config):
(create_nb_config.id, create_nb_config.nodebalancer_id),
)

assert "ThisNewLabel" == node_updated.label
assert new_label == node_updated.label
assert 50 == node_updated.weight
assert "accept" == node_updated.mode

Expand Down