Skip to content

TPT-4261: Implement integration tests for Expand Create Linodes Options and Password-less Linodes#693

Merged
psnoch-akamai merged 3 commits into
linode:proj/slade-cleofrom
psnoch-akamai:TPT-4261-python-sdk-implement-integration-tests-for-expand-create-linodes-options-and-password-less
May 12, 2026
Merged

TPT-4261: Implement integration tests for Expand Create Linodes Options and Password-less Linodes#693
psnoch-akamai merged 3 commits into
linode:proj/slade-cleofrom
psnoch-akamai:TPT-4261-python-sdk-implement-integration-tests-for-expand-create-linodes-options-and-password-less

Conversation

@psnoch-akamai
Copy link
Copy Markdown
Contributor

📝 Description

Implement integration tests for Expand Create Linodes Options and Password-less Linodes

✔️ How to Test

make TEST_CASE=test_expected_error_if_fields_authorized_users_authorized_keys_root_pass_are_not_set test-int
make TEST_CASE=test_create_linode_with_kernel_and_boot_size_then_add_disk_and_rebuild test-int

…d_keys_root_pass_are_not_set and def test_create_linode_with_kernel_and_boot_size_then_add_disk_and_rebuild
@psnoch-akamai psnoch-akamai requested a review from a team as a code owner May 7, 2026 12:45
@psnoch-akamai psnoch-akamai added the testing for updates to the testing suite in the changelog. label May 7, 2026
@psnoch-akamai psnoch-akamai requested review from yec-akamai and removed request for a team May 7, 2026 12:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds new integration coverage around Linode creation options (kernel, boot_size) and validation behavior when creating an Instance from an Image without root_pass / authorized_users / authorized_keys.

Changes:

  • Adds a new session-scoped fixture that creates a Linode using kernel and boot_size with authorized_keys.
  • Adds an integration test asserting instance_create raises a ValueError when none of root_pass, authorized_users, or authorized_keys are provided.
  • Adds an integration test that creates a disk and then rebuilds the Linode.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +245 to +253
linode_instance = client.linode.instance_create(
"g6-nanode-1",
region,
image="linode/debian12",
label=label,
kernel="linode/6.15.7-x86_64-linode169",
boot_size=9000,
authorized_keys="ssh-rsa",
)
region,
image="linode/debian12",
label=label,
kernel="linode/6.15.7-x86_64-linode169",
Comment on lines +242 to +252
region = get_region(client, {"Linodes", "Cloud Firewall"}, site_type="core")
label = get_test_label(length=8)

linode_instance = client.linode.instance_create(
"g6-nanode-1",
region,
image="linode/debian12",
label=label,
kernel="linode/6.15.7-x86_64-linode169",
boot_size=9000,
authorized_keys="ssh-rsa",
image="linode/debian12",
label=label,
kernel="linode/6.15.7-x86_64-linode169",
boot_size="9000",
3,
linode_create.rebuild,
"linode/debian12",
authorized_keys="ecdsa-sha2-nistp",
Comment thread test/integration/models/linode/test_linode.py
@ezilber-akamai ezilber-akamai changed the title Implement integration tests for Expand Create Linodes Options and Password-less Linodes TPT-4261: Implement integration tests for Expand Create Linodes Options and Password-less Linodes May 7, 2026
@psnoch-akamai psnoch-akamai requested a review from Copilot May 8, 2026 15:26
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.

Comment on lines +238 to +243
@pytest.fixture(scope="session")
def create_linode_with_authorization_key(test_linode_client, ssh_key_gen):
client = test_linode_client

region = get_region(client, {"Linodes", "Cloud Firewall"}, site_type="core")
label = get_test_label(length=8)
Comment on lines +1187 to +1208
def test_expected_error_if_fields_authorized_users_authorized_keys_root_pass_are_not_set(
test_linode_client,
):
client = test_linode_client
region = get_region(client, {"Linodes", "Cloud Firewall"}, site_type="core")
label = get_test_label(length=8)

with pytest.raises(ValueError) as create_instance_error:
client.linode.instance_create(
"g6-nanode-1",
region,
image="linode/debian12",
label=label,
kernel="linode/latest-64bit",
boot_size=9000,
)
assert (
"When creating an Instance from an Image, at least one of root_pass, authorized_users, or authorized_keys must be provided."
in str(create_instance_error.value)
)


Comment thread test/integration/models/linode/test_linode.py
@@ -1,4 +1,5 @@
import ipaddress
import random
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.

Without this import there is error NameError: name 'random' is not defined.

Copy link
Copy Markdown
Member

@zliang-akamai zliang-akamai May 12, 2026

Choose a reason for hiding this comment

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

@psnoch-akamai I think you can use the random label helper (get_test_label) for the randomized label before so then we won't have to import random

@psnoch-akamai psnoch-akamai force-pushed the TPT-4261-python-sdk-implement-integration-tests-for-expand-create-linodes-options-and-password-less branch from 34254e0 to 44b0454 Compare May 8, 2026 15:46
Copy link
Copy Markdown
Contributor

@ezilber-akamai ezilber-akamai left a comment

Choose a reason for hiding this comment

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

Tests are passing locally. There are a few remaining stylistic CoPilot suggestions but nothing critical. Nice work!

linode_create.disk_create,
size=2000,
image="linode/debian12",
label="python-disk-test-" + random.randrange(100000, 999999).__str__(),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we use get_test_label here?

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.

Good idea, changed

@psnoch-akamai psnoch-akamai merged commit 1f7bd4c into linode:proj/slade-cleo May 12, 2026
12 checks passed
ezilber-akamai added a commit that referenced this pull request May 12, 2026
* TPT-4527: Implemented changes for SLADE and CLEO projects (#665)

* Implemented changes for SLADE and CLEO projects

* Address CoPilot suggestions

* Reference newer debian version in examples

* Fixed boot_size in unit tests

* Add authorized_users as one of the required params alongside root_pass and authorized_keys

* Fix lint

* Fix docstring

* Address suggestions

* Drop root_pass from returned fields for instance_create, rebuild, and disk_create

* Fix lint

* TPT-4261: Implement integration tests for Expand Create Linodes Options and Password-less Linodes (#693)

* Create tests test_expected_error_if_fields_authorized_users_authorized_keys_root_pass_are_not_set and def test_create_linode_with_kernel_and_boot_size_then_add_disk_and_rebuild

* Add copilot suggestions

* Add code review suggestions

---------

Co-authored-by: Pawel <100145168+psnoch-akamai@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing for updates to the testing suite in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants