Skip to content

ACLP: Cleanup entity related response fields from alert definition#943

Open
shkaruna wants to merge 5 commits intolinode:mainfrom
shkaruna:cleanup/entity-related-fields
Open

ACLP: Cleanup entity related response fields from alert definition#943
shkaruna wants to merge 5 commits intolinode:mainfrom
shkaruna:cleanup/entity-related-fields

Conversation

@shkaruna
Copy link
Copy Markdown
Contributor

📝 Description

Cleanup entity related response fields from alert definition.
Removed entity_ids and has_more_resources response fields of ACLP alerting APIs.
Updated test cases.

✔️ How to Test

What are the steps to reproduce the issue or verify the changes?
Not applicable

How do I run the relevant unit/integration tests?
Prerequisites
Go 1.19+ installed
Valid Linode API token with monitor permissions
Export LINODE_TOKEN environment variable for integration tests

Unit tests:

Run Monitor alert definition unit tests:
go test -v ./test/unit/... -run MonitorAlertDefinition
Output:
=== RUN TestCreateMonitorAlertDefinition
--- PASS: TestCreateMonitorAlertDefinition (0.00s)
=== RUN TestCreateMonitorAlertDefinitionWithIdempotency
--- PASS: TestCreateMonitorAlertDefinitionWithIdempotency (0.00s)
=== RUN TestGetMonitorAlertDefinition
--- PASS: TestGetMonitorAlertDefinition (0.00s)
=== RUN TestListMonitorAlertDefinitions
--- PASS: TestListMonitorAlertDefinitions (0.00s)
=== RUN TestUpdateMonitorAlertDefinition
--- PASS: TestUpdateMonitorAlertDefinition (0.00s)
=== RUN TestDeleteMonitorAlertDefinition
--- PASS: TestDeleteMonitorAlertDefinition (0.00s)
=== RUN TestListMonitorAlertDefinitionEntities
--- PASS: TestListMonitorAlertDefinitionEntities (0.00s)
PASS
ok github.com/linode/linodego/test/unit 0.007s

Integration tests:

Play:
make test-int
make test-int TEST_ARGS='-run "Alert"'
cd test && make test-int TEST_TIMEOUT=5h
make[1]: Entering directory '/home/shkaruna/sdk/linodego/test'
2026/04/27 18:57:06 [INFO] LINODE_FIXTURE_MODE play will be used for tests
2026/04/27 18:57:06 [INFO] Fixture mode play - Test Linode Cloud Firewall not created
=== RUN TestMonitorAlertDefinition_smoke
--- PASS: TestMonitorAlertDefinition_smoke (0.00s)
=== RUN TestMonitorAlertDefinitions_List
--- PASS: TestMonitorAlertDefinitions_List (0.00s)
=== RUN TestMonitorAlertChannels_List
--- PASS: TestMonitorAlertChannels_List (0.00s)
=== RUN TestMonitorAlertDefinition_CreateWithIdempotency
--- PASS: TestMonitorAlertDefinition_CreateWithIdempotency (0.00s)
=== RUN TestMonitorAlertDefinitionEntities_List
--- PASS: TestMonitorAlertDefinitionEntities_List (0.00s)
PASS
ok github.com/linode/linodego/test/integration (cached)
make[1]: Leaving directory '/home/shkaruna/sdk/linodego/test'

Record
export LINODE_TOKEN="Linode API token"
ENABLE_CLOUD_FW=false make TEST_ARGS='-run "Alert"' fixtures

shkaruna added 5 commits April 9, 2026 09:26
Add entity envelope in AlertDefinition GET, POST and PUT API responses. Add new method to list entities. Update tests.
Remove entity_ids and has_more_resources response fields
Comment thread test/unit/monitor_alert_definitions_test.go
@shkaruna shkaruna marked this pull request as ready for review May 6, 2026 04:05
@shkaruna shkaruna requested a review from a team as a code owner May 6, 2026 04:05
Copilot AI review requested due to automatic review settings May 6, 2026 04:05
@shkaruna shkaruna requested a review from a team as a code owner May 6, 2026 04:05
@shkaruna shkaruna requested review from jriddle-linode and psnoch-akamai and removed request for a team May 6, 2026 04:05
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 updates the Monitor (ACLP) alert definition model and test fixtures to reflect API responses that no longer include the top-level entity_ids and has_more_resources fields, relying instead on the nested entities object for entity metadata.

Changes:

  • Removed entity_ids and top-level has_more_resources from AlertDefinition response struct.
  • Updated unit/integration tests to stop asserting on removed response fields.
  • Re-recorded/updated integration fixtures to match the new response shape.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
monitor_alert_definitions.go Removes deprecated entity-related response fields from AlertDefinition.
test/unit/monitor_alert_definitions_test.go Updates mock JSON fixtures and assertions to stop referencing removed fields; removes a label-only update test.
test/integration/monitor_alert_definitions_test.go Removes assertions against EntityIDs in the created alert response.
test/integration/fixtures/TestMonitorAlertDefinitions_List.yaml Updates recorded responses to omit entity_ids and top-level has_more_resources.
test/integration/fixtures/TestMonitorAlertDefinitionEntities_List.yaml Updates recorded responses to omit removed top-level fields.
test/integration/fixtures/TestMonitorAlertDefinition.yaml Updates recorded create/get/update flows to omit removed top-level fields and adjusts recorded IDs/timestamps.
test/integration/fixtures/TestMonitorAlertDefinition_CreateWithIdempotency.yaml Updates recorded create/delete interactions to omit removed top-level fields and refreshes recorded values.

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

Comment thread monitor_alert_definitions.go
Comment thread monitor_alert_definitions.go
Copy link
Copy Markdown

@satkumar-akamai satkumar-akamai left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants