-
Notifications
You must be signed in to change notification settings - Fork 87
TPT-4261: Implement integration tests for Expand Create Linodes Options and Password-less Linodes #693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
psnoch-akamai
merged 3 commits into
linode:proj/slade-cleo
from
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
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| import ipaddress | ||
| import random | ||
| import time | ||
| from test.integration.conftest import get_region | ||
| from test.integration.helpers import ( | ||
|
|
@@ -234,6 +235,28 @@ def linode_with_disk_encryption(test_linode_client, request): | |
| linode_instance.delete() | ||
|
|
||
|
|
||
| @pytest.fixture(scope="session") | ||
| def create_linode_with_authorization_key(test_linode_client, e2e_test_firewall): | ||
| client = test_linode_client | ||
|
|
||
| region = get_region(client, {"Linodes", "Cloud Firewall"}, site_type="core") | ||
| label = get_test_label(length=8) | ||
|
Comment on lines
+237
to
+242
|
||
|
|
||
| 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", | ||
|
|
||
| ) | ||
|
Comment on lines
+244
to
+252
|
||
|
|
||
| yield linode_instance | ||
|
|
||
| linode_instance.delete() | ||
|
|
||
|
|
||
| # Test helper | ||
| def get_status(linode: Instance, status: str): | ||
| return linode.status == status | ||
|
|
@@ -1159,3 +1182,54 @@ def test_update_linode_maintenance_policy(create_linode, test_linode_client): | |
| linode.invalidate() | ||
| assert result | ||
| assert linode.maintenance_policy_id == non_default_policy.slug | ||
|
|
||
|
|
||
| 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/6.15.7-x86_64-linode169", | ||
| 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 on lines
+1186
to
+1207
|
||
| def test_create_linode_with_kernel_and_boot_size_then_add_disk_and_rebuild( | ||
| create_linode_with_authorization_key, | ||
| ): | ||
| linode_create = create_linode_with_authorization_key | ||
| assert linode_create.image.id == "linode/debian12" | ||
|
|
||
| wait_for_condition(10, 300, get_status, linode_create, "running") | ||
| disk_create = send_request_when_resource_available( | ||
| 300, | ||
| linode_create.disk_create, | ||
| size=2000, | ||
| image="linode/debian12", | ||
| label="python-disk-test-" + random.randrange(100000, 999999).__str__(), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good idea, changed |
||
| root_pass="aComplex@Password123", | ||
| ) | ||
| wait_for_disk_status(disk_create, 120) | ||
| assert disk_create.status == "ready" | ||
|
|
||
| retry_sending_request( | ||
| 3, | ||
| linode_create.rebuild, | ||
| "linode/debian12", | ||
| authorized_keys="ecdsa-sha2-nistp", | ||
|
|
||
| ) | ||
|
zliang-akamai marked this conversation as resolved.
|
||
| wait_for_condition(10, 300, get_status, linode_create, "rebuilding") | ||
| assert linode_create.status == "rebuilding" | ||
|
zliang-akamai marked this conversation as resolved.
|
||
| assert linode_create.image.id == "linode/debian12" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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 importrandom