Refactor instance_basic testing playbook#805
Open
mawilk90 wants to merge 16 commits into
Open
Conversation
Release v0.41.1
Release v0.42.0
Release v0.43.0
Release v0.44.0
Release v0.45.0
Playbook tries to update an instance using updated label what creates a new instance as label is not a mutable field. This commit reverts the changes merged in linode#691 using tags instead of label to update existing instance
Contributor
There was a problem hiding this comment.
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_basicintegration 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 on lines
+117
to
+118
| MUTABLE_FIELDS: Set[str] = {"tags"} | ||
|
|
| ) | ||
| 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 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
📝 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