Skip to content
Open
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
7 changes: 1 addition & 6 deletions linode_api4/objects/database.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
from dataclasses import dataclass, field
from typing import Optional

from linode_api4.objects import (
Base,
JSONObject,
MappedObject,
Property,
)
from linode_api4.objects import Base, JSONObject, MappedObject, Property


class DatabaseType(Base):
Expand Down
7 changes: 2 additions & 5 deletions test/integration/linode_client/test_linode_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,9 @@ def test_fails_to_create_image_with_non_existing_disk_id(
disk_id = 111111

try:
image_page = client.image_create(
disk=disk_id, label=label, description=description
)
client.image_create(disk=disk_id, label=label, description=description)
except ApiError as e:
assert "Not found" in str(e.json)
assert e.status == 404
assert 400 <= e.status < 500
Copy link
Copy Markdown
Contributor

@mawilk90 mawilk90 May 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I spotted that API returns [403] Unauthorized for disk_id = 111111 or 111112 or 111122 etc., but not for 122222 or 123456 (then the error is [404] Not Found). IMO, it's a bit strange and inconsistent. Does it make sense to use e.g. disk_id = 123456 to get [404] Not Found as before and instead of possible range of error codes (400 <= e.status < 500) and clarify this behaviour with API Team?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, not sure why API returns inconsistent error message. I did the error code range check just to make sure it's a client error, so it can tolerates the small backend divergence like this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will ask API Team about that on Monday



def test_fails_to_delete_predefined_images(setup_client_and_linode):
Expand Down
6 changes: 3 additions & 3 deletions test/integration/models/linode/test_linode.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def linode_for_disk_tests(test_linode_client, e2e_test_firewall):
linode_instance, password = client.linode.instance_create(
"g6-nanode-1",
region,
image="linode/alpine3.19",
image="linode/ubuntu24.04",
label=label + "_long_tests",
firewall=e2e_test_firewall,
)
Expand Down Expand Up @@ -174,7 +174,7 @@ def linode_with_block_storage_encryption(test_linode_client, e2e_test_firewall):
linode_instance, password = client.linode.instance_create(
"g6-nanode-1",
region,
image="linode/alpine3.19",
image="linode/ubuntu24.04",
label=label + "block-storage-encryption",
firewall=e2e_test_firewall,
)
Expand Down Expand Up @@ -215,7 +215,7 @@ def linode_with_disk_encryption(test_linode_client, request):
linode_instance, password = client.linode.instance_create(
"g6-nanode-1",
target_region,
image="linode/ubuntu24.10",
image="linode/ubuntu24.04",
label=label,
booted=False,
disk_encryption=disk_encryption,
Expand Down
6 changes: 2 additions & 4 deletions test/integration/models/sharegroups/test_sharegroups.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import datetime
from test.integration.conftest import get_region
from test.integration.helpers import (
get_test_label,
)
from test.integration.helpers import get_test_label

import pytest

Expand Down Expand Up @@ -44,7 +42,7 @@ def sample_linode(test_linode_client, e2e_test_firewall):
linode_instance, password = client.linode.instance_create(
"g6-nanode-1",
region,
image="linode/alpine3.19",
image="linode/ubuntu24.04",
label=label + "_modlinode",
)
yield linode_instance
Expand Down
Loading