diff --git a/monitor_alert_definitions.go b/monitor_alert_definitions.go index 730665655..bc057e8d9 100644 --- a/monitor_alert_definitions.go +++ b/monitor_alert_definitions.go @@ -53,7 +53,6 @@ type AlertDefinition struct { Type string `json:"type"` ServiceType string `json:"service_type"` Status AlertDefinitionStatus `json:"status"` - HasMoreResources bool `json:"has_more_resources"` // Deprecated: use Entities.HasMoreResources. RuleCriteria RuleCriteria `json:"rule_criteria"` TriggerConditions TriggerConditions `json:"trigger_conditions"` AlertChannels []AlertChannelEnvelope `json:"alert_channels"` @@ -61,7 +60,6 @@ type AlertDefinition struct { Updated *time.Time `json:"-"` UpdatedBy string `json:"updated_by"` CreatedBy string `json:"created_by"` - EntityIDs []string `json:"entity_ids"` // Deprecated: use Entities.url to list associated entities. Description string `json:"description"` Class string `json:"class"` Scope AlertDefinitionScope `json:"scope"` diff --git a/test/integration/fixtures/TestMonitorAlertDefinition.yaml b/test/integration/fixtures/TestMonitorAlertDefinition.yaml index d02b3b171..8ae0739a2 100644 --- a/test/integration/fixtures/TestMonitorAlertDefinition.yaml +++ b/test/integration/fixtures/TestMonitorAlertDefinition.yaml @@ -18,8 +18,7 @@ interactions: "High Memory Usage Plan Dedicated", "description": "Alert triggers when dedicated plan nodes consistently reach critical memory usage, risking application performance degradation.", "service_type": "dbaas", "type": "system", "scope": "entity", - "class": "dedicated", "regions": [], "status": "enabled", "entity_ids": ["324478", - "324480", "324483", "324486", "394528"], "has_more_resources": false, "severity": + "class": "dedicated", "regions": [], "status": "enabled", "severity": 2, "rule_criteria": {"rules": [{"label": "Memory Usage", "metric": "memory_usage", "unit": "percent", "aggregate_function": "avg", "operator": "gt", "threshold": 95, "dimension_filters": []}]}, "alert_channels": [{"id": 10000, "label": "Read-Write @@ -32,8 +31,7 @@ interactions: Usage Plan Shared", "description": "Alert triggers when shared plan nodes consistently reach critical memory usage, risking application performance degradation.", "service_type": "dbaas", "type": "system", "scope": "entity", "class": "shared", - "regions": [], "status": "enabled", "entity_ids": ["190003", "257626"], "has_more_resources": - false, "severity": 2, "rule_criteria": {"rules": [{"label": "Memory Usage", + "regions": [], "status": "enabled", "severity": 2, "rule_criteria": {"rules": [{"label": "Memory Usage", "metric": "memory_usage", "unit": "percent", "aggregate_function": "avg", "operator": "gt", "threshold": 90, "dimension_filters": []}]}, "alert_channels": [{"id": 10000, "label": "Read-Write Channel", "url": "/monitor/alert-channels/10000", @@ -43,8 +41,7 @@ interactions: "system", "updated_by": "system", "entities": {"url": "/monitor/services/dbaas/alert-definitions/10001/entities", "has_more_resources": false, "count": 2}}, {"id": 11001, "label": "test_alert_logs_prod", "description": "some desc1", "service_type": "logs", "type": "user", "scope": - "entity", "class": null, "regions": [], "status": "enabled", "entity_ids": ["100"], - "has_more_resources": false, "severity": 2, "rule_criteria": {"rules": [{"label": + "entity", "class": null, "regions": [], "status": "enabled", "severity": 2, "rule_criteria": {"rules": [{"label": "Successful Upload Count", "metric": "success_upload_count", "unit": "count", "aggregate_function": "sum", "operator": "lt", "threshold": 100000, "dimension_filters": []}]}, "alert_channels": [{"id": 10004, "label": "Alert Channel", "url": @@ -55,8 +52,7 @@ interactions: "tester", "entities": {"url": "/monitor/services/logs/alert-definitions/11001/entities", "has_more_resources": false, "count": 1}}, {"id": 11021, "label": "Test Alert", "description": "Test Alert", "service_type": "dbaas", "type": "user", "scope": "entity", "class": null, "regions": [], "status": - "enabled", "entity_ids": ["257626", "394528"], "has_more_resources": false, - "severity": 1, "rule_criteria": {"rules": [{"label": "Memory Usage", "metric": + "enabled", "severity": 1, "rule_criteria": {"rules": [{"label": "Memory Usage", "metric": "memory_usage", "unit": "percent", "aggregate_function": "sum", "operator": "gt", "threshold": 100, "dimension_filters": []}]}, "alert_channels": [{"id": 10004, "label": "Alert Channel", "url": "/monitor/alert-channels/10004", @@ -88,7 +84,7 @@ interactions: Content-Type: - application/json Expires: - - Wed, 08 Apr 2026 06:05:05 GMT + - Mon, 27 Apr 2026 12:32:17 GMT Pragma: - no-cache Strict-Transport-Security: @@ -130,10 +126,9 @@ interactions: url: https://api.linode.com/v4beta/monitor/services/dbaas/alert-definitions method: POST response: - body: '{"id": 11022, "label": "go-test-alert-definition-create", "description": + body: '{"id": 11072, "label": "go-test-alert-definition-create", "description": "Test alert definition creation", "service_type": "dbaas", "type": "user", "scope": - "entity", "class": null, "regions": [], "status": "provisioning", "entity_ids": - [], "has_more_resources": false, "severity": 2, "rule_criteria": {"rules": [{"label": + "entity", "class": null, "regions": [], "status": "provisioning", "severity": 2, "rule_criteria": {"rules": [{"label": "Memory Usage", "metric": "memory_usage", "unit": "percent", "aggregate_function": "avg", "operator": "gt", "threshold": 90, "dimension_filters": [{"label": "Node Type", "dimension_label": "node_type", "operator": "eq", "value": "primary"}]}]}, @@ -142,7 +137,7 @@ interactions: "polling_interval_seconds": 300, "evaluation_period_seconds": 300, "trigger_occurrences": 1}, "created": "2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05", "created_by": "tester", "updated_by": "tester", "entities": - {"url": "/monitor/services/dbaas/alert-definitions/11022/entities", "has_more_resources": + {"url": "/monitor/services/dbaas/alert-definitions/11072/entities", "has_more_resources": false, "count": 0}}' headers: Access-Control-Allow-Credentials: @@ -166,7 +161,7 @@ interactions: Content-Type: - application/json Expires: - - Wed, 08 Apr 2026 06:05:06 GMT + - Mon, 27 Apr 2026 12:32:18 GMT Pragma: - no-cache Strict-Transport-Security: @@ -203,13 +198,12 @@ interactions: - application/json User-Agent: - linodego/dev https://github.com/linode/linodego - url: https://api.linode.com/v4beta/monitor/services/dbaas/alert-definitions/11022 + url: https://api.linode.com/v4beta/monitor/services/dbaas/alert-definitions/11072 method: GET response: - body: '{"id": 11022, "label": "go-test-alert-definition-create", "description": + body: '{"id": 11072, "label": "go-test-alert-definition-create", "description": "Test alert definition creation", "service_type": "dbaas", "type": "user", "scope": - "entity", "class": null, "regions": [], "status": "enabled", "entity_ids": [], - "has_more_resources": false, "severity": 2, "rule_criteria": {"rules": [{"label": + "entity", "class": null, "regions": [], "status": "enabled", "severity": 2, "rule_criteria": {"rules": [{"label": "Memory Usage", "metric": "memory_usage", "unit": "percent", "aggregate_function": "avg", "operator": "gt", "threshold": 90, "dimension_filters": [{"label": "Node Type", "dimension_label": "node_type", "operator": "eq", "value": "primary"}]}]}, @@ -218,7 +212,7 @@ interactions: "polling_interval_seconds": 300, "evaluation_period_seconds": 300, "trigger_occurrences": 1}, "created": "2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05", "created_by": "tester", "updated_by": "tester", "entities": - {"url": "/monitor/services/dbaas/alert-definitions/11022/entities", "has_more_resources": + {"url": "/monitor/services/dbaas/alert-definitions/11072/entities", "has_more_resources": false, "count": 0}}' headers: Access-Control-Allow-Credentials: @@ -242,7 +236,7 @@ interactions: Content-Type: - application/json Expires: - - Wed, 08 Apr 2026 06:05:22 GMT + - Mon, 27 Apr 2026 12:32:35 GMT Pragma: - no-cache Strict-Transport-Security: @@ -281,13 +275,12 @@ interactions: - application/json User-Agent: - linodego/dev https://github.com/linode/linodego - url: https://api.linode.com/v4beta/monitor/services/dbaas/alert-definitions/11022 + url: https://api.linode.com/v4beta/monitor/services/dbaas/alert-definitions/11072 method: PUT response: - body: '{"id": 11022, "label": "go-test-alert-definition-create-updated", "description": + body: '{"id": 11072, "label": "go-test-alert-definition-create-updated", "description": "Test alert definition creation", "service_type": "dbaas", "type": "user", "scope": - "entity", "class": null, "regions": [], "status": "enabled", "entity_ids": [], - "has_more_resources": false, "severity": 2, "rule_criteria": {"rules": [{"label": + "entity", "class": null, "regions": [], "status": "enabled", "severity": 2, "rule_criteria": {"rules": [{"label": "Memory Usage", "metric": "memory_usage", "unit": "percent", "aggregate_function": "avg", "operator": "gt", "threshold": 90, "dimension_filters": [{"label": "Node Type", "dimension_label": "node_type", "operator": "eq", "value": "primary"}]}]}, @@ -296,7 +289,7 @@ interactions: "polling_interval_seconds": 300, "evaluation_period_seconds": 300, "trigger_occurrences": 1}, "created": "2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05", "created_by": "tester", "updated_by": "tester", "entities": - {"url": "/monitor/services/dbaas/alert-definitions/11022/entities", "has_more_resources": + {"url": "/monitor/services/dbaas/alert-definitions/11072/entities", "has_more_resources": false, "count": 0}}' headers: Access-Control-Allow-Credentials: @@ -320,7 +313,7 @@ interactions: Content-Type: - application/json Expires: - - Wed, 08 Apr 2026 06:05:24 GMT + - Mon, 27 Apr 2026 12:32:36 GMT Pragma: - no-cache Strict-Transport-Security: @@ -357,7 +350,7 @@ interactions: - application/json User-Agent: - linodego/dev https://github.com/linode/linodego - url: https://api.linode.com/v4beta/monitor/services/dbaas/alert-definitions/11022 + url: https://api.linode.com/v4beta/monitor/services/dbaas/alert-definitions/11072 method: DELETE response: body: '{}' @@ -385,7 +378,7 @@ interactions: Content-Type: - application/json Expires: - - Wed, 08 Apr 2026 06:05:25 GMT + - Mon, 27 Apr 2026 12:32:37 GMT Pragma: - no-cache Strict-Transport-Security: diff --git a/test/integration/fixtures/TestMonitorAlertDefinitionEntities_List.yaml b/test/integration/fixtures/TestMonitorAlertDefinitionEntities_List.yaml index 8e2a96872..00eea72af 100644 --- a/test/integration/fixtures/TestMonitorAlertDefinitionEntities_List.yaml +++ b/test/integration/fixtures/TestMonitorAlertDefinitionEntities_List.yaml @@ -18,8 +18,7 @@ interactions: "High Memory Usage Plan Dedicated", "description": "Alert triggers when dedicated plan nodes consistently reach critical memory usage, risking application performance degradation.", "service_type": "dbaas", "type": "system", "scope": "entity", - "class": "dedicated", "regions": [], "status": "enabled", "entity_ids": ["324478", - "324480", "324483", "324486", "394528"], "has_more_resources": false, "severity": + "class": "dedicated", "regions": [], "status": "enabled", "severity": 2, "rule_criteria": {"rules": [{"label": "Memory Usage", "metric": "memory_usage", "unit": "percent", "aggregate_function": "avg", "operator": "gt", "threshold": 95, "dimension_filters": []}]}, "alert_channels": [{"id": 10000, "label": "Read-Write @@ -51,7 +50,7 @@ interactions: Content-Type: - application/json Expires: - - Wed, 08 Apr 2026 05:55:13 GMT + - Mon, 27 Apr 2026 12:32:51 GMT Pragma: - no-cache Strict-Transport-Security: @@ -123,7 +122,7 @@ interactions: Content-Type: - application/json Expires: - - Wed, 08 Apr 2026 05:55:14 GMT + - Mon, 27 Apr 2026 12:32:52 GMT Pragma: - no-cache Strict-Transport-Security: diff --git a/test/integration/fixtures/TestMonitorAlertDefinition_CreateWithIdempotency.yaml b/test/integration/fixtures/TestMonitorAlertDefinition_CreateWithIdempotency.yaml index 13e0e8681..3a2630f41 100644 --- a/test/integration/fixtures/TestMonitorAlertDefinition_CreateWithIdempotency.yaml +++ b/test/integration/fixtures/TestMonitorAlertDefinition_CreateWithIdempotency.yaml @@ -47,7 +47,7 @@ interactions: Content-Type: - application/json Expires: - - Wed, 08 Apr 2026 06:27:41 GMT + - Mon, 27 Apr 2026 12:32:45 GMT Pragma: - no-cache Strict-Transport-Security: @@ -76,7 +76,7 @@ interactions: code: 200 duration: "" - request: - body: '{"label":"go-test-alert-definition-idempotency-1775629661986967956","severity":2,"channel_ids":[10000],"rule_criteria":{"rules":[{"aggregate_function":"avg","dimension_filters":[{"dimension_label":"node_type","operator":"eq","value":"primary"}],"metric":"memory_usage","operator":"gt","threshold":90}]},"trigger_conditions":{"criteria_condition":"ALL","evaluation_period_seconds":300,"polling_interval_seconds":300,"trigger_occurrences":1},"description":"Test + body: '{"label":"go-test-alert-definition-idempotency-1777293165535535919","severity":2,"channel_ids":[10000],"rule_criteria":{"rules":[{"aggregate_function":"avg","dimension_filters":[{"dimension_label":"node_type","operator":"eq","value":"primary"}],"metric":"memory_usage","operator":"gt","threshold":90}]},"trigger_conditions":{"criteria_condition":"ALL","evaluation_period_seconds":300,"polling_interval_seconds":300,"trigger_occurrences":1},"description":"Test alert definition creation with idempotency"}' form: {} headers: @@ -89,11 +89,10 @@ interactions: url: https://api.linode.com/v4beta/monitor/services/dbaas/alert-definitions method: POST response: - body: '{"id": 11023, "label": "go-test-alert-definition-idempotency-1775629661986967956", + body: '{"id": 11073, "label": "go-test-alert-definition-idempotency-1777293165535535919", "description": "Test alert definition creation with idempotency", "service_type": "dbaas", "type": "user", "scope": "entity", "class": null, "regions": [], "status": - "provisioning", "entity_ids": [], "has_more_resources": false, "severity": 2, - "rule_criteria": {"rules": [{"label": "Memory Usage", "metric": "memory_usage", + "provisioning", "severity": 2, "rule_criteria": {"rules": [{"label": "Memory Usage", "metric": "memory_usage", "unit": "percent", "aggregate_function": "avg", "operator": "gt", "threshold": 90, "dimension_filters": [{"label": "Node Type", "dimension_label": "node_type", "operator": "eq", "value": "primary"}]}]}, "alert_channels": [{"id": 10000, @@ -101,7 +100,7 @@ interactions: "alert-channels"}], "trigger_conditions": {"criteria_condition": "ALL", "polling_interval_seconds": 300, "evaluation_period_seconds": 300, "trigger_occurrences": 1}, "created": "2018-01-02T03:04:05", "updated": "2018-01-02T03:04:05", "created_by": "tester", - "updated_by": "tester", "entities": {"url": "/monitor/services/dbaas/alert-definitions/11023/entities", + "updated_by": "tester", "entities": {"url": "/monitor/services/dbaas/alert-definitions/11073/entities", "has_more_resources": false, "count": 0}}' headers: Access-Control-Allow-Credentials: @@ -125,7 +124,7 @@ interactions: Content-Type: - application/json Expires: - - Wed, 08 Apr 2026 06:27:43 GMT + - Mon, 27 Apr 2026 12:32:46 GMT Pragma: - no-cache Strict-Transport-Security: @@ -153,7 +152,7 @@ interactions: code: 200 duration: "" - request: - body: '{"label":"go-test-alert-definition-idempotency-1775629661986967956","severity":2,"channel_ids":[10000],"rule_criteria":{"rules":[{"aggregate_function":"avg","dimension_filters":[{"dimension_label":"node_type","operator":"eq","value":"primary"}],"metric":"memory_usage","operator":"gt","threshold":90}]},"trigger_conditions":{"criteria_condition":"ALL","evaluation_period_seconds":300,"polling_interval_seconds":300,"trigger_occurrences":1},"description":"Test + body: '{"label":"go-test-alert-definition-idempotency-1777293165535535919","severity":2,"channel_ids":[10000],"rule_criteria":{"rules":[{"aggregate_function":"avg","dimension_filters":[{"dimension_label":"node_type","operator":"eq","value":"primary"}],"metric":"memory_usage","operator":"gt","threshold":90}]},"trigger_conditions":{"criteria_condition":"ALL","evaluation_period_seconds":300,"polling_interval_seconds":300,"trigger_occurrences":1},"description":"Test alert definition creation with idempotency"}' form: {} headers: @@ -184,7 +183,7 @@ interactions: Content-Type: - application/json Expires: - - Wed, 08 Apr 2026 06:27:43 GMT + - Mon, 27 Apr 2026 12:32:47 GMT Pragma: - no-cache Strict-Transport-Security: @@ -213,7 +212,7 @@ interactions: - application/json User-Agent: - linodego/dev https://github.com/linode/linodego - url: https://api.linode.com/v4beta/monitor/services/dbaas/alert-definitions/11023 + url: https://api.linode.com/v4beta/monitor/services/dbaas/alert-definitions/11073 method: DELETE response: body: '{}' @@ -241,7 +240,7 @@ interactions: Content-Type: - application/json Expires: - - Wed, 08 Apr 2026 06:27:44 GMT + - Mon, 27 Apr 2026 12:32:48 GMT Pragma: - no-cache Strict-Transport-Security: diff --git a/test/integration/fixtures/TestMonitorAlertDefinitions_List.yaml b/test/integration/fixtures/TestMonitorAlertDefinitions_List.yaml index 7179797d6..7fa1c7992 100644 --- a/test/integration/fixtures/TestMonitorAlertDefinitions_List.yaml +++ b/test/integration/fixtures/TestMonitorAlertDefinitions_List.yaml @@ -18,8 +18,7 @@ interactions: "High Memory Usage Plan Dedicated", "description": "Alert triggers when dedicated plan nodes consistently reach critical memory usage, risking application performance degradation.", "service_type": "dbaas", "type": "system", "scope": "entity", - "class": "dedicated", "regions": [], "status": "enabled", "entity_ids": ["324478", - "324480", "324483", "324486", "394528"], "has_more_resources": false, "severity": + "class": "dedicated", "regions": [], "status": "enabled", "severity": 2, "rule_criteria": {"rules": [{"label": "Memory Usage", "metric": "memory_usage", "unit": "percent", "aggregate_function": "avg", "operator": "gt", "threshold": 95, "dimension_filters": []}]}, "alert_channels": [{"id": 10000, "label": "Read-Write @@ -32,8 +31,7 @@ interactions: Usage Plan Shared", "description": "Alert triggers when shared plan nodes consistently reach critical memory usage, risking application performance degradation.", "service_type": "dbaas", "type": "system", "scope": "entity", "class": "shared", - "regions": [], "status": "enabled", "entity_ids": ["190003", "257626"], "has_more_resources": - false, "severity": 2, "rule_criteria": {"rules": [{"label": "Memory Usage", + "regions": [], "status": "enabled", "rule_criteria": {"rules": [{"label": "Memory Usage", "metric": "memory_usage", "unit": "percent", "aggregate_function": "avg", "operator": "gt", "threshold": 90, "dimension_filters": []}]}, "alert_channels": [{"id": 10000, "label": "Read-Write Channel", "url": "/monitor/alert-channels/10000", @@ -43,8 +41,7 @@ interactions: "system", "updated_by": "system", "entities": {"url": "/monitor/services/dbaas/alert-definitions/10001/entities", "has_more_resources": false, "count": 2}}, {"id": 11001, "label": "test_alert_logs_prod", "description": "some desc1", "service_type": "logs", "type": "user", "scope": - "entity", "class": null, "regions": [], "status": "enabled", "entity_ids": ["100"], - "has_more_resources": false, "severity": 2, "rule_criteria": {"rules": [{"label": + "entity", "class": null, "regions": [], "status": "enabled", "severity": 2, "rule_criteria": {"rules": [{"label": "Successful Upload Count", "metric": "success_upload_count", "unit": "count", "aggregate_function": "sum", "operator": "lt", "threshold": 100000, "dimension_filters": []}]}, "alert_channels": [{"id": 10004, "label": "Alert Channel", "url": @@ -55,8 +52,7 @@ interactions: "tester", "entities": {"url": "/monitor/services/logs/alert-definitions/11001/entities", "has_more_resources": false, "count": 1}}, {"id": 11021, "label": "Test Alert", "description": "Test Alert", "service_type": "dbaas", "type": "user", "scope": "entity", "class": null, "regions": [], "status": - "enabled", "entity_ids": ["257626", "394528"], "has_more_resources": false, - "severity": 1, "rule_criteria": {"rules": [{"label": "Memory Usage", "metric": + "enabled", "severity": 1, "rule_criteria": {"rules": [{"label": "Memory Usage", "metric": "memory_usage", "unit": "percent", "aggregate_function": "sum", "operator": "gt", "threshold": 100, "dimension_filters": []}]}, "alert_channels": [{"id": 10004, "label": "Alert Channel", "url": "/monitor/alert-channels/10004", @@ -88,7 +84,7 @@ interactions: Content-Type: - application/json Expires: - - Wed, 08 Apr 2026 06:19:02 GMT + - Mon, 27 Apr 2026 12:32:41 GMT Pragma: - no-cache Strict-Transport-Security: diff --git a/test/integration/monitor_alert_definitions_test.go b/test/integration/monitor_alert_definitions_test.go index 566fc4f6f..eb3f11ba4 100644 --- a/test/integration/monitor_alert_definitions_test.go +++ b/test/integration/monitor_alert_definitions_test.go @@ -113,8 +113,6 @@ func TestMonitorAlertDefinition_smoke(t *testing.T) { assert.Equal(t, createOpts.Label, createdAlert.Label) assert.Equal(t, createOpts.Severity, createdAlert.Severity) assert.Equal(t, *createOpts.Description, createdAlert.Description) - assert.ElementsMatch(t, createOpts.EntityIDs, createdAlert.EntityIDs) - // assert.Equal(t, fetchedChannel.Label, createdAlert.AlertChannels[0].Label) // More thorough assertions on the created alert's nested fields // TriggerConditions is a struct, so it is never nil diff --git a/test/unit/monitor_alert_definitions_test.go b/test/unit/monitor_alert_definitions_test.go index c8e742db8..b512c8599 100644 --- a/test/unit/monitor_alert_definitions_test.go +++ b/test/unit/monitor_alert_definitions_test.go @@ -22,10 +22,6 @@ const ( "description": "A test alert for dbaas service", "scope": "entity", "regions": [], - "entity_ids": [ - "12345" - ], - "has_more_resources": false, "alert_channels": [ { "id": 10000, @@ -84,10 +80,6 @@ const ( "status": "enabled", "scope": "entity", "regions": [], - "entity_ids": [ - "12345" - ], - "has_more_resources": true, "alert_channels": [ { "id": 10000, @@ -148,11 +140,6 @@ const ( "scope": "entity", "description": "A test alert for dbaas service", "regions": [], - "entity_ids": [ - "12345", - "45678" - ], - "has_more_resources": true, "alert_channels": [ { "id": 10000, @@ -198,8 +185,6 @@ const ( "updated_by": "tester" }` - monitorAlertDefinitionUpdateLabelOnlyResponseSingleLine = `{"id": 123, "label": "test-alert-definition-renamed-one-line", "severity": 1, "type": "some_type", "service_type": "dbaas", "status": "enabled", "entity_ids": ["12345"], "channel_ids": [1], "is_enabled": true}` - monitorAlertDefinitionEntitiesListResponse = `{ "data": [ { @@ -253,8 +238,6 @@ func TestCreateMonitorAlertDefinition(t *testing.T) { assert.Equal(t, "/monitor/services/dbaas/alert-definitions/123/entities", alert.Entities.URL) assert.Equal(t, 0, alert.Entities.Count) assert.False(t, alert.Entities.HasMoreResources) - assert.Equal(t, []string{"12345"}, alert.EntityIDs) - assert.False(t, alert.HasMoreResources) assert.NotNil(t, alert.AlertChannels) assert.NotNil(t, alert.RuleCriteria) assert.NotNil(t, alert.RuleCriteria.Rules) @@ -311,8 +294,6 @@ func TestGetMonitorAlertDefinition(t *testing.T) { assert.Equal(t, "/monitor/services/dbaas/alert-definitions/123/entities", alert.Entities.URL) assert.Equal(t, 0, alert.Entities.Count) assert.False(t, alert.Entities.HasMoreResources) - assert.Equal(t, []string{"12345"}, alert.EntityIDs) - assert.False(t, alert.HasMoreResources) assert.NotNil(t, alert.AlertChannels) assert.NotNil(t, alert.RuleCriteria) assert.NotNil(t, alert.RuleCriteria.Rules) @@ -336,8 +317,6 @@ func TestListMonitorAlertDefinitions(t *testing.T) { assert.Equal(t, "/monitor/services/dbaas/alert-definitions/123/entities", alerts[0].Entities.URL) assert.Equal(t, 2, alerts[0].Entities.Count) assert.True(t, alerts[0].Entities.HasMoreResources) - assert.Equal(t, []string{"12345"}, alerts[0].EntityIDs) - assert.True(t, alerts[0].HasMoreResources) assert.NotNil(t, alerts[0].AlertChannels) assert.NotNil(t, alerts[0].RuleCriteria) assert.NotNil(t, alerts[0].RuleCriteria.Rules) @@ -365,6 +344,7 @@ func TestUpdateMonitorAlertDefinition(t *testing.T) { ) assert.NoError(t, err) assert.NotNil(t, alert) + assert.Equal(t, testMonitorAlertDefinitionID, alert.ID) assert.Equal(t, "test-alert-definition-renamed", alert.Label) assert.Equal(t, 2, alert.Severity) assert.Equal(t, linodego.AlertDefinitionScopeEntity, alert.Scope) @@ -372,31 +352,6 @@ func TestUpdateMonitorAlertDefinition(t *testing.T) { assert.Equal(t, "/monitor/services/dbaas/alert-definitions/123/entities", alert.Entities.URL) assert.Equal(t, 2, alert.Entities.Count) assert.True(t, alert.Entities.HasMoreResources) - assert.True(t, alert.HasMoreResources) -} - -func TestUpdateMonitorAlertDefinition_LabelOnly(t *testing.T) { - var base ClientBaseCase - base.SetUp(t) - defer base.TearDown(t) - - // Mock a PUT that returns the single-line fixture - base.MockPut("monitor/services/dbaas/alert-definitions/123", json.RawMessage(monitorAlertDefinitionUpdateLabelOnlyResponseSingleLine)) - - updateOpts := linodego.AlertDefinitionUpdateOptions{ - Label: "test-alert-definition-renamed-one-line", - } - - alert, err := base.Client.UpdateMonitorAlertDefinition( - context.Background(), - testMonitorAlertDefinitionServiceType, - testMonitorAlertDefinitionID, - updateOpts, - ) - assert.NoError(t, err) - assert.NotNil(t, alert) - assert.Equal(t, "test-alert-definition-renamed-one-line", alert.Label) - assert.Equal(t, testMonitorAlertDefinitionID, alert.ID) } func TestDeleteMonitorAlertDefinition(t *testing.T) {