Skip to content

Refactor instance_basic testing playbook#805

Open
mawilk90 wants to merge 16 commits into
linode:proj/reserved-ipsfrom
mawilk90:hotfix/revert_changes_in_instance_basic
Open

Refactor instance_basic testing playbook#805
mawilk90 wants to merge 16 commits into
linode:proj/reserved-ipsfrom
mawilk90:hotfix/revert_changes_in_instance_basic

Conversation

@mawilk90
Copy link
Copy Markdown
Contributor

@mawilk90 mawilk90 commented May 20, 2026

📝 Description

Playbook tries to update an instance using an updated label. It creates a new instance as label is not a mutable field. This commit reverts the changes merged in #691 using tags instead of label to update existing instance.

Note:
It depends on #788

✔️ How to Test

make TEST_SUITE="instance_basic" test-int

@mawilk90 mawilk90 added improvement for improvements in existing functionality in the changelog. testing for updates to the testing suite in the changelog. labels May 20, 2026
@mawilk90 mawilk90 changed the base branch from dev to proj/reserved-ips May 21, 2026 07:22
@mawilk90 mawilk90 added the do-not-merge PRs that should not be merged until the commented issue is resolved label May 21, 2026
@mawilk90 mawilk90 marked this pull request as ready for review May 21, 2026 07:23
@mawilk90 mawilk90 requested review from a team as code owners May 21, 2026 07:23
@mawilk90 mawilk90 requested review from jriddle-linode, mgwoj and psnoch-akamai and removed request for a team, jriddle-linode and psnoch-akamai May 21, 2026 07:23
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 expands the Linode collection’s reserved IPv4 coverage and updates integration tests to avoid non-mutable instance label updates by using tags instead, aligning tests with the API’s immutability constraints.

Changes:

  • Refactors instance_basic integration testing to update an instance via tags (not label) and improves region selection using availability.
  • Adds Reserved IPv4 modules (reserved_ip, reserved_ip_info, reserved_ip_list) plus integration/unit tests and documentation.
  • Extends existing modules (ip, instance, nodebalancer) to support reserved IPv4 assignment/promotion and tag updates where applicable.

Reviewed changes

Copilot reviewed 32 out of 33 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/unit/modules/test_ip.py Adds unit tests for new ip module behaviors (promotion + tags).
tests/integration/targets/reserved_ip_list/tasks/main.yaml Adds integration coverage for listing reserved IPs.
tests/integration/targets/reserved_ip_info/tasks/main.yaml Adds integration coverage for retrieving reserved IP details.
tests/integration/targets/reserved_ip_basic/tasks/main.yaml Adds integration coverage for create/update/delete reserved IPs.
tests/integration/targets/nodebalancer_reserved_ip/tasks/main.yaml Adds integration coverage for NodeBalancer creation with a reserved IP.
tests/integration/targets/ip_info/tasks/main.yaml Updates test image version.
tests/integration/targets/ip_basic/tasks/main.yaml Updates test image version; adds promotion-to-reserved and tag idempotency coverage.
tests/integration/targets/instance_reserved_ip/tasks/main.yaml Adds integration coverage for instance creation with a reserved IP.
tests/integration/targets/instance_basic/tasks/main.yaml Refactors update path to use tags; improves region selection.
requirements.txt Pins linode_api4 to a git branch dependency.
README.md Updates module listing/descriptions for new/expanded IP functionality.
plugins/modules/reserved_ip.py Introduces module to create/update/delete reserved IPv4 addresses.
plugins/modules/reserved_ip_list.py Introduces module to list/filter reserved IPv4 addresses.
plugins/modules/reserved_ip_info.py Introduces module to fetch info for a specific reserved IPv4 address.
plugins/modules/nodebalancer.py Adds create-only ipv4 support and excludes it from update handling.
plugins/modules/ip.py Extends module to update existing IPs (promote to reserved, update tags) and allocate reserved IPs by region.
plugins/modules/instance.py Adds create-only ipv4 reserved assignment and excludes it from updates.
plugins/module_utils/linode_helper.py Makes unordered diffing robust when old/new values are None.
plugins/module_utils/doc_fragments/reserved_ip.py Adds specdoc fragments for reserved_ip.
plugins/module_utils/doc_fragments/reserved_ip_list.py Adds specdoc fragments for reserved_ip_list.
plugins/module_utils/doc_fragments/reserved_ip_info.py Adds specdoc fragments for reserved_ip_info.
plugins/module_utils/doc_fragments/nodebalancer.py Adds example for NodeBalancer reserved IP creation.
plugins/module_utils/doc_fragments/ip.py Updates examples/samples for reserved IP promotion/allocation.
plugins/module_utils/doc_fragments/ip_info.py Updates samples to include reserved IP fields.
plugins/module_utils/doc_fragments/instance.py Adds example for instance creation with a reserved IPv4.
docs/modules/reserved_ip.md Adds generated docs for reserved_ip.
docs/modules/reserved_ip_list.md Adds generated docs for reserved_ip_list.
docs/modules/reserved_ip_info.md Adds generated docs for reserved_ip_info.
docs/modules/nodebalancer.md Documents ipv4 create-only field.
docs/modules/ip.md Documents expanded ip module behaviors and return value.
docs/modules/ip_rdns.md Updates sample responses to include new IP fields.
docs/modules/ip_info.md Updates sample responses to include new IP fields.
docs/modules/instance.md Documents ipv4 reserved assignment parameter.

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

Comment thread plugins/modules/ip.py
Comment on lines +117 to +118
MUTABLE_FIELDS: Set[str] = {"tags"}

Comment thread plugins/modules/ip.py
)
return None

def _update_tags(self, address: str, ip: IPAddress) -> Optional[list]:
Comment on lines +158 to +159
- update.instance.tags[0] == 'ansible-test'
- update.instance.tags[1] == 'testing'
Comment on lines +174 to +176
- info_id.instance.maintenance_policy == toggled_maintenance_policy
- info_id.instance.tags[0] == 'ansible-test'
- info_id.instance.tags[1] == 'testing'
Comment on lines 141 to 151
- name: Update the instance
linode.cloud.instance:
label: '{{ updated_label }}'
label: '{{ create.instance.label }}'
region: '{{ pg_region }}'
type: g6-standard-1
image: linode/ubuntu22.04
private_ip: true
maintenance_policy: '{{ toggled_maintenance_policy }}'
state: present
tags: '{{ instance_tags }}'
register: update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge PRs that should not be merged until the commented issue is resolved improvement for improvements in existing functionality in the changelog. testing for updates to the testing suite in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants