TPT-3925: Use omitzero for ACLP alerts to support empty lists#928
TPT-3925: Use omitzero for ACLP alerts to support empty lists#928yec-akamai wants to merge 8 commits intoproj/aclp-linode-alertsfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Linode instance “ACLP alerts” structures to use pointer-to-slice fields so callers can explicitly send empty alert lists ([]) instead of having the field omitted (nil) during JSON marshaling, addressing downstream Terraform test expectations.
Changes:
- Change
InstanceAlertandInstanceACLPAlertsOptionsalert list fields from[]intto*[]int. - Update unit tests to handle pointer alert lists when reading and constructing request options.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 10 comments.
| File | Description |
|---|---|
instances.go |
Switches alert list fields to *[]int to distinguish omitted vs explicitly empty arrays in JSON. |
test/unit/instance_test.go |
Adjusts tests to dereference alert list pointers and updates request option construction accordingly. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
d651c58 to
af4eaeb
Compare
mgwoj
left a comment
There was a problem hiding this comment.
PR title does not match the final changes. Also the changes in the code are not aligned with the changes in the tests.
Updated the PR title. There is not much to change in the test case since we avoid to make breaking changes. Already verfied the omitzero works as expected across terraform. |
|
Which tests is showing that this change with |
📝 Description
Use omitzero for alerts to make sure it explicitly pass an empty list instead of null.
Address terraform test issue: linode/terraform-provider-linode#2259
✔️ How to Test