Skip to content

Commit

Permalink
fix: test renames
Browse files Browse the repository at this point in the history
  • Loading branch information
celaus committed Nov 14, 2024
1 parent ddaec21 commit 3cec3ba
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions coralogix/resource_coralogix_alert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,30 +326,30 @@ func TestAccCoralogixResourceAlert_logs_more_than_usual(t *testing.T) {
resource.TestCheckResourceAttr(alertResourceName, "schedule.active_on.start_time.minutes", "30"),
resource.TestCheckResourceAttr(alertResourceName, "schedule.active_on.end_time.hours", "20"),
resource.TestCheckResourceAttr(alertResourceName, "schedule.active_on.end_time.minutes", "30"),
resource.TestCheckTypeSetElemNestedAttrs(alertResourceName, "type_definition.logs_unusual.logs_filter.simple_filter.label_filters.application_name.*",
resource.TestCheckTypeSetElemNestedAttrs(alertResourceName, "type_definition.logs_anomaly.logs_filter.simple_filter.label_filters.application_name.*",
map[string]string{
"operation": "IS",
"value": "nginx",
},
),
resource.TestCheckTypeSetElemNestedAttrs(alertResourceName, "type_definition.logs_unusual.logs_filter.simple_filter.label_filters.subsystem_name.*",
resource.TestCheckTypeSetElemNestedAttrs(alertResourceName, "type_definition.logs_anomaly.logs_filter.simple_filter.label_filters.subsystem_name.*",
map[string]string{
"operation": "IS",
"value": "subsystem-name",
},
),
resource.TestCheckResourceAttr(alertResourceName, "type_definition.logs_unusual.logs_filter.simple_filter.lucene_query", "message:\"error\""),
resource.TestCheckTypeSetElemAttr(alertResourceName, "type_definition.logs_unusual.logs_filter.simple_filter.label_filters.severities.*", "Warning"),
resource.TestCheckResourceAttr(alertResourceName, "type_definition.logs_unusual.rules.#", "1"),
resource.TestCheckTypeSetElemNestedAttrs(alertResourceName, "type_definition.logs_unusual.rules.*",
resource.TestCheckResourceAttr(alertResourceName, "type_definition.logs_anomaly.logs_filter.simple_filter.lucene_query", "message:\"error\""),
resource.TestCheckTypeSetElemAttr(alertResourceName, "type_definition.logs_anomaly.logs_filter.simple_filter.label_filters.severities.*", "Warning"),
resource.TestCheckResourceAttr(alertResourceName, "type_definition.logs_anomaly.rules.#", "1"),
resource.TestCheckTypeSetElemNestedAttrs(alertResourceName, "type_definition.logs_anomaly.rules.*",
map[string]string{
"minimum_threshold": "2",
"time_window": "10_MINUTES",
},
),
resource.TestCheckTypeSetElemAttr(alertResourceName, "type_definition.logs_unusual.notification_payload_filter.*", "coralogix.metadata.sdkId"),
resource.TestCheckTypeSetElemAttr(alertResourceName, "type_definition.logs_unusual.notification_payload_filter.*", "coralogix.metadata.sdkName"),
resource.TestCheckTypeSetElemAttr(alertResourceName, "type_definition.logs_unusual.notification_payload_filter.*", "coralogix.metadata.sdkVersion"),
resource.TestCheckTypeSetElemAttr(alertResourceName, "type_definition.logs_anomaly.notification_payload_filter.*", "coralogix.metadata.sdkId"),
resource.TestCheckTypeSetElemAttr(alertResourceName, "type_definition.logs_anomaly.notification_payload_filter.*", "coralogix.metadata.sdkName"),
resource.TestCheckTypeSetElemAttr(alertResourceName, "type_definition.logs_anomaly.notification_payload_filter.*", "coralogix.metadata.sdkVersion"),
),
},
{
Expand All @@ -366,23 +366,23 @@ func TestAccCoralogixResourceAlert_logs_more_than_usual(t *testing.T) {
resource.TestCheckResourceAttr(alertResourceName, "notification_group.webhooks_settings.#", "1"),
resource.TestCheckResourceAttr(alertResourceName, "incidents_settings.notify_on", "Triggered and Resolved"),
resource.TestCheckResourceAttr(alertResourceName, "incidents_settings.retriggering_period.minutes", "1"),
resource.TestCheckResourceAttr(alertResourceName, "type_definition.logs_unusual.logs_filter.simple_filter.lucene_query", "message:\"updated_error\""),
resource.TestCheckTypeSetElemNestedAttrs(alertResourceName, "type_definition.logs_unusual.logs_filter.simple_filter.label_filters.application_name.*",
resource.TestCheckResourceAttr(alertResourceName, "type_definition.logs_anomaly.logs_filter.simple_filter.lucene_query", "message:\"updated_error\""),
resource.TestCheckTypeSetElemNestedAttrs(alertResourceName, "type_definition.logs_anomaly.logs_filter.simple_filter.label_filters.application_name.*",
map[string]string{
"operation": "IS",
"value": "nginx",
},
),
resource.TestCheckTypeSetElemNestedAttrs(alertResourceName, "type_definition.logs_unusual.logs_filter.simple_filter.label_filters.subsystem_name.*",
resource.TestCheckTypeSetElemNestedAttrs(alertResourceName, "type_definition.logs_anomaly.logs_filter.simple_filter.label_filters.subsystem_name.*",
map[string]string{
"operation": "IS",
"value": "subsystem-name",
},
),
resource.TestCheckTypeSetElemAttr(alertResourceName, "type_definition.logs_unusual.logs_filter.simple_filter.label_filters.severities.*", "Warning"),
resource.TestCheckTypeSetElemAttr(alertResourceName, "type_definition.logs_unusual.logs_filter.simple_filter.label_filters.severities.*", "Error"),
resource.TestCheckResourceAttr(alertResourceName, "type_definition.logs_unusual.rules.#", "1"),
resource.TestCheckTypeSetElemNestedAttrs(alertResourceName, "type_definition.logs_unusual.rules.*",
resource.TestCheckTypeSetElemAttr(alertResourceName, "type_definition.logs_anomaly.logs_filter.simple_filter.label_filters.severities.*", "Warning"),
resource.TestCheckTypeSetElemAttr(alertResourceName, "type_definition.logs_anomaly.logs_filter.simple_filter.label_filters.severities.*", "Error"),
resource.TestCheckResourceAttr(alertResourceName, "type_definition.logs_anomaly.rules.#", "1"),
resource.TestCheckTypeSetElemNestedAttrs(alertResourceName, "type_definition.logs_anomaly.rules.*",
map[string]string{
"minimum_threshold": "20",
"time_window": "1_HOUR",
Expand Down Expand Up @@ -1005,9 +1005,9 @@ func TestAccCoralogixResourceAlert_metric_less_than_usual(t *testing.T) {
resource.TestCheckResourceAttr(alertResourceName, "name", "metric-less-than-usual alert example"),
resource.TestCheckResourceAttr(alertResourceName, "description", "Example of metric-less-than-usual alert from terraform"),
resource.TestCheckResourceAttr(alertResourceName, "priority", "P1"),
resource.TestCheckResourceAttr(alertResourceName, "type_definition.metric_unusual.metric_filter.promql", "sum(rate(http_requests_total{job=\"api-server\"}[5m])) by (status)"),
resource.TestCheckResourceAttr(alertResourceName, "type_definition.metric_unusual.rules.#", "1"),
resource.TestCheckTypeSetElemNestedAttrs(alertResourceName, "type_definition.metric_unusual.rules.*",
resource.TestCheckResourceAttr(alertResourceName, "type_definition.metric_anomaly.metric_filter.promql", "sum(rate(http_requests_total{job=\"api-server\"}[5m])) by (status)"),
resource.TestCheckResourceAttr(alertResourceName, "type_definition.metric_anomaly.rules.#", "1"),
resource.TestCheckTypeSetElemNestedAttrs(alertResourceName, "type_definition.metric_anomaly.rules.*",
map[string]string{
"threshold": "20",
"for_over_pct": "10",
Expand All @@ -1028,9 +1028,9 @@ func TestAccCoralogixResourceAlert_metric_less_than_usual(t *testing.T) {
resource.TestCheckResourceAttr(alertResourceName, "name", "metric-less-than-usual alert example updated"),
resource.TestCheckResourceAttr(alertResourceName, "description", "Example of metric-less-than-usual alert from terraform updated"),
resource.TestCheckResourceAttr(alertResourceName, "priority", "P1"),
resource.TestCheckResourceAttr(alertResourceName, "type_definition.metric_unusual.metric_filter.promql", "sum(rate(http_requests_total{job=\"api-server\"}[5m])) by (status)"),
resource.TestCheckResourceAttr(alertResourceName, "type_definition.metric_unusual.rules.#", "1"),
resource.TestCheckTypeSetElemNestedAttrs(alertResourceName, "type_definition.metric_unusual.rules.*",
resource.TestCheckResourceAttr(alertResourceName, "type_definition.metric_anomaly.metric_filter.promql", "sum(rate(http_requests_total{job=\"api-server\"}[5m])) by (status)"),
resource.TestCheckResourceAttr(alertResourceName, "type_definition.metric_anomaly.rules.#", "1"),
resource.TestCheckTypeSetElemNestedAttrs(alertResourceName, "type_definition.metric_anomaly.rules.*",
map[string]string{
"threshold": "2",
"for_over_pct": "10",
Expand Down Expand Up @@ -1847,7 +1847,7 @@ func testAccCoralogixResourceAlertLogsMoreThanUsual() string {
}
type_definition = {
logs_unusual = {
logs_anomaly = {
rules = [{
minimum_threshold = 2
time_window = "10_MINUTES"
Expand Down Expand Up @@ -1900,7 +1900,7 @@ func testAccCoralogixResourceAlertLogsMoreThanUsualUpdated() string {
}
type_definition = {
logs_unusual = {
logs_anomaly = {
logs_filter = {
simple_filter = {
lucene_query = "message:\"updated_error\""
Expand Down Expand Up @@ -2542,7 +2542,7 @@ func testAccCoralogixResourceAlertMetricsLessThanUsual() string {
priority = "P1"
type_definition = {
metric_unusual = {
metric_anomaly = {
metric_filter = {
promql = "sum(rate(http_requests_total{job=\"api-server\"}[5m])) by (status)"
}
Expand All @@ -2568,7 +2568,7 @@ func testAccCoralogixResourceAlertMetricsLessThanUsualUpdated() string {
priority = "P1"
type_definition = {
metric_unusual = {
metric_anomaly = {
metric_filter = {
promql = "sum(rate(http_requests_total{job=\"api-server\"}[5m])) by (status)"
}
Expand Down

0 comments on commit 3cec3ba

Please sign in to comment.