Skip to content
Draft
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
12 changes: 12 additions & 0 deletions test/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,12 @@ def test_domain(test_linode_client):
domain=domain_addr, soa_email=soa_email, tags=["test-tag"]
)

def get_domain_status():
domain.invalidate()
return domain.status == "active"

wait_for_condition(3, 30, get_domain_status)

# Create a SRV record
domain.record_create(
"SRV",
Expand All @@ -333,6 +339,12 @@ def test_volume(test_linode_client):

volume = client.volume_create(label=label, region=region)

def get_volume_status():
volume.invalidate()
return volume.status == "active"

wait_for_condition(5, 45, get_volume_status)

yield volume

send_request_when_resource_available(timeout=100, func=volume.delete)
Expand Down
43 changes: 24 additions & 19 deletions test/integration/linode_client/test_linode_client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import re
import time
from test.integration.conftest import get_region
from test.integration.helpers import get_test_label
from test.integration.helpers import get_test_label, wait_for_condition

import pytest

Expand Down Expand Up @@ -55,10 +55,11 @@ def test_fails_to_create_domain_without_soa_email(setup_client_and_linode):

timestamp = str(time.time_ns())
domain_addr = timestamp + "example.com"
try:
domain = client.domain_create(domain=domain_addr)
except ApiError as e:
assert e.status == 400

with pytest.raises(ApiError) as exc_info:
client.domain_create(domain=domain_addr)

assert exc_info.value.status == 400


@pytest.mark.smoke
Expand Down Expand Up @@ -90,11 +91,16 @@ def test_get_regions(test_linode_client):
def test_image_create(setup_client_and_linode):
client = setup_client_and_linode[0]
linode = setup_client_and_linode[1]

label = get_test_label()
description = "Test description"
tags = ["test"]
usable_disk = [v for v in linode.disks if v.filesystem != "swap"]

def linode_disks_are_ready(linode_instance):
linode_instance.invalidate()
disks = [d for d in linode_instance.disks if d.filesystem != "swap"]
return disks if disks else None

usable_disk = wait_for_condition(5, 120, linode_disks_are_ready, linode)

image = client.image_create(
disk=usable_disk[0].id, label=label, description=description, tags=tags
Expand All @@ -116,23 +122,23 @@ def test_fails_to_create_image_with_non_existing_disk_id(
description = "Test description"
disk_id = 111111

try:
with pytest.raises(ApiError) as exc_info:
client.image_create(disk=disk_id, label=label, description=description)
except ApiError as e:
assert 400 <= e.status < 500

# TODO: Specific status code may be used when defect is solved: ARB-7797
assert 400 <= exc_info.value.status < 500


def test_fails_to_delete_predefined_images(setup_client_and_linode):
client = setup_client_and_linode[0]

images = client.images()

try:
with pytest.raises(ApiError, match="Unauthorized") as exc_info:
# new images go on top of the list thus choose last image
images.last().delete()
except ApiError as e:
assert "Unauthorized" in str(e.json)
assert e.status == 403

assert exc_info.value.status == 403


def test_get_volume(test_linode_client, test_volume):
Expand Down Expand Up @@ -345,16 +351,15 @@ def test_fails_to_create_cluster_with_invalid_version(test_linode_client):
client = test_linode_client
region = get_region(client, {"Kubernetes"}).id

try:
cluster = client.lke.cluster_create(
with pytest.raises(ApiError, match="not valid") as exc_info:
client.lke.cluster_create(
region,
"example-cluster",
invalid_version,
{"type": "g6-standard-1", "count": 3},
)
except ApiError as e:
assert "not valid" in str(e.json)
assert e.status == 400

assert exc_info.value.status == 400


# ObjectStorageGroupTests
Expand Down
3 changes: 1 addition & 2 deletions test/integration/models/domain/test_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ def test_clone(test_linode_client, test_domain):
dom = "example.clone-" + timestamp + "-inttestsdk.org"
domain.clone(dom)

time.sleep(1)
time.sleep(3)

ds = test_linode_client.domains()

domains = [i.domain for i in ds]

assert dom in domains
Expand Down
2 changes: 1 addition & 1 deletion test/integration/models/linode/test_linode.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def test_linode_rebuild(test_linode_client):
root_pass="aComplex@Password123",
)

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

retry_sending_request(
3,
Expand Down
2 changes: 1 addition & 1 deletion test/integration/models/placement/test_placement.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def test_pg_migration(

# Says it could take up to ~6 hrs for migration to fully complete
send_request_when_resource_available(
300,
400,
linode.initiate_migration,
placement_group=pg_inbound.id,
migration_type=MigrationType.COLD,
Expand Down