From f2d19adef93ef1236ce97af44ae335b115875cbc Mon Sep 17 00:00:00 2001 From: Max Hahn Date: Thu, 29 Aug 2024 13:46:22 -0700 Subject: [PATCH 1/2] Remove schedule block from monitorv2 This feature had been moved upstream and no longer exists in this resource. --- docs/resources/monitor_v2.md | 10 ------- observe/data_source_monitor_v2_test.go | 18 ++++-------- observe/resource_monitor_v2.go | 34 +++------------------- observe/resource_monitor_v2_action_test.go | 18 ++++-------- observe/resource_monitor_v2_test.go | 18 ++++-------- 5 files changed, 22 insertions(+), 76 deletions(-) diff --git a/docs/resources/monitor_v2.md b/docs/resources/monitor_v2.md index b3b9bf73..4ace5d3d 100644 --- a/docs/resources/monitor_v2.md +++ b/docs/resources/monitor_v2.md @@ -464,18 +464,8 @@ Optional: Optional: -- `interval` (Block List, Max: 1) Should be used to run explicit ad-hoc queries. (see [below for nested schema](#nestedblock--scheduling--interval)) - `transform` (Block List, Max: 1) Should be used to defer scheduling to the transformer and evaluate when data becomes available. (see [below for nested schema](#nestedblock--scheduling--transform)) - -### Nested Schema for `scheduling.interval` - -Required: - -- `interval` (String) How often the monitor should attempt to run. -- `randomize` (String) A maximum +/- to apply to the interval to avoid things like harmonics and work stacking up in parallel. - - ### Nested Schema for `scheduling.transform` diff --git a/observe/data_source_monitor_v2_test.go b/observe/data_source_monitor_v2_test.go index 19c11b98..e2e2225e 100644 --- a/observe/data_source_monitor_v2_test.go +++ b/observe/data_source_monitor_v2_test.go @@ -9,7 +9,6 @@ import ( ) func TestAccObserveGetIDMonitorV2CountData(t *testing.T) { - t.Skip("Skipping until monitorv2 resource fixed to match upstream") randomPrefix := acctest.RandomWithPrefix("tf") resource.ParallelTest(t, resource.TestCase{ @@ -47,9 +46,8 @@ func TestAccObserveGetIDMonitorV2CountData(t *testing.T) { } } scheduling { - interval { - interval = "15m" - randomize = "0" + transform { + freshness_goal = "15m" } } } @@ -75,7 +73,6 @@ func TestAccObserveGetIDMonitorV2CountData(t *testing.T) { } func TestAccObserveGetIDMonitorV2Threshold(t *testing.T) { - t.Skip("Skipping until monitorv2 resource fixed to match upstream") randomPrefix := acctest.RandomWithPrefix("tf") resource.ParallelTest(t, resource.TestCase{ @@ -107,9 +104,8 @@ func TestAccObserveGetIDMonitorV2Threshold(t *testing.T) { } } scheduling { - interval { - interval = "15m" - randomize = "0" + transform { + freshness_goal = "15m" } } } @@ -137,7 +133,6 @@ func TestAccObserveGetIDMonitorV2Threshold(t *testing.T) { } func TestAccObserveGetIDMonitorV2Promote(t *testing.T) { - t.Skip("Skipping until monitorv2 resource fixed to match upstream") randomPrefix := acctest.RandomWithPrefix("tf") resource.ParallelTest(t, resource.TestCase{ @@ -174,9 +169,8 @@ func TestAccObserveGetIDMonitorV2Promote(t *testing.T) { } } scheduling { - interval { - interval = "15m" - randomize = "0" + transform { + freshness_goal = "15m" } } } diff --git a/observe/resource_monitor_v2.go b/observe/resource_monitor_v2.go index d7693f8d..f0cd3e92 100644 --- a/observe/resource_monitor_v2.go +++ b/observe/resource_monitor_v2.go @@ -216,37 +216,11 @@ func resourceMonitorV2() *schema.Resource { Description: descriptions.Get("monitorv2", "schema", "scheduling", "description"), Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "interval": { // MonitorV2IntervalScheduleInput - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - ExactlyOneOf: []string{"scheduling.0.interval", "scheduling.0.transform"}, - Description: descriptions.Get("monitorv2", "schema", "scheduling", "interval", "description"), - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "interval": { // Duration! - Type: schema.TypeString, - Required: true, - ValidateDiagFunc: validateTimeDuration, - DiffSuppressFunc: diffSuppressTimeDurationZeroDistinctFromEmpty, - Description: descriptions.Get("monitorv2", "schema", "scheduling", "interval", "interval"), - }, - "randomize": { // Duration! - Type: schema.TypeString, - Required: true, - ValidateDiagFunc: validateTimeDuration, - DiffSuppressFunc: diffSuppressTimeDurationZeroDistinctFromEmpty, - Description: descriptions.Get("monitorv2", "schema", "scheduling", "interval", "randomize"), - }, - }, - }, - }, "transform": { // MonitorV2TransformScheduleInput - Type: schema.TypeList, - Optional: true, - MaxItems: 1, - ExactlyOneOf: []string{"scheduling.0.interval", "scheduling.0.transform"}, - Description: descriptions.Get("monitorv2", "schema", "scheduling", "transform", "description"), + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Description: descriptions.Get("monitorv2", "schema", "scheduling", "transform", "description"), Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "freshness_goal": { // Duration! diff --git a/observe/resource_monitor_v2_action_test.go b/observe/resource_monitor_v2_action_test.go index 2b7a8fed..b73a6815 100644 --- a/observe/resource_monitor_v2_action_test.go +++ b/observe/resource_monitor_v2_action_test.go @@ -9,7 +9,6 @@ import ( ) func TestAccObserveMonitorV2ActionEmail(t *testing.T) { - t.Skip("Skipping until monitorv2 resource fixed to match upstream") randomPrefix := acctest.RandomWithPrefix("tf") resource.ParallelTest(t, resource.TestCase{ @@ -47,9 +46,8 @@ func TestAccObserveMonitorV2ActionEmail(t *testing.T) { } } scheduling { - interval { - interval = "15m" - randomize = "0" + transform { + freshness_target = "15m" } } actions { @@ -95,7 +93,6 @@ func TestAccObserveMonitorV2ActionEmail(t *testing.T) { } func TestAccObserveMonitorV2ActionWebhook(t *testing.T) { - t.Skip("Skipping until monitorv2 resource fixed to match upstream") randomPrefix := acctest.RandomWithPrefix("tf") resource.ParallelTest(t, resource.TestCase{ @@ -133,9 +130,8 @@ func TestAccObserveMonitorV2ActionWebhook(t *testing.T) { } } scheduling { - interval { - interval = "15m" - randomize = "0" + transform { + freshness_target = "15m" } } actions { @@ -181,7 +177,6 @@ func TestAccObserveMonitorV2ActionWebhook(t *testing.T) { } func TestAccObserveMonitorV2MultipleActionsEmail(t *testing.T) { - t.Skip("Skipping until monitorv2 resource fixed to match upstream") randomPrefix := acctest.RandomWithPrefix("tf") resource.ParallelTest(t, resource.TestCase{ @@ -219,9 +214,8 @@ func TestAccObserveMonitorV2MultipleActionsEmail(t *testing.T) { } } scheduling { - interval { - interval = "15m" - randomize = "0" + transform { + freshness_target = "15m" } } actions { diff --git a/observe/resource_monitor_v2_test.go b/observe/resource_monitor_v2_test.go index 2da4a65b..448d971b 100644 --- a/observe/resource_monitor_v2_test.go +++ b/observe/resource_monitor_v2_test.go @@ -11,7 +11,6 @@ import ( var monitorV2ConfigPreamble = configPreamble + datastreamConfigPreamble func TestAccObserveMonitorV2Count(t *testing.T) { - t.Skip("Skipping until monitorv2 resource fixed to match upstream") randomPrefix := acctest.RandomWithPrefix("tf") resource.ParallelTest(t, resource.TestCase{ @@ -49,9 +48,8 @@ func TestAccObserveMonitorV2Count(t *testing.T) { } } scheduling { - interval { - interval = "15m" - randomize = "0" + transform { + freshness_target = "15m" } } } @@ -73,7 +71,6 @@ func TestAccObserveMonitorV2Count(t *testing.T) { } func TestAccObserveMonitorV2Threshold(t *testing.T) { - t.Skip("Skipping until monitorv2 resource fixed to match upstream") randomPrefix := acctest.RandomWithPrefix("tf") resource.ParallelTest(t, resource.TestCase{ @@ -105,9 +102,8 @@ func TestAccObserveMonitorV2Threshold(t *testing.T) { } } scheduling { - interval { - interval = "15m" - randomize = "0" + transform { + freshness_target = "15m" } } } @@ -131,7 +127,6 @@ func TestAccObserveMonitorV2Threshold(t *testing.T) { } func TestAccObserveMonitorV2Promote(t *testing.T) { - t.Skip("Skipping until monitorv2 resource fixed to match upstream") randomPrefix := acctest.RandomWithPrefix("tf") resource.ParallelTest(t, resource.TestCase{ @@ -168,9 +163,8 @@ func TestAccObserveMonitorV2Promote(t *testing.T) { } } scheduling { - interval { - interval = "15m" - randomize = "0" + transform { + freshness_target = "15m" } } } From eaf9fe7cb38ac14e20223ef2ce1828199691ff1d Mon Sep 17 00:00:00 2001 From: Max Hahn Date: Thu, 29 Aug 2024 14:00:16 -0700 Subject: [PATCH 2/2] Remove `interval` scheduling form monitorv2 datasource --- docs/data-sources/monitor_v2.md | 10 ---------- observe/data_source_monitor_v2.go | 20 -------------------- observe/data_source_monitor_v2_test.go | 13 +++++-------- observe/resource_monitor_v2_action_test.go | 6 +++--- observe/resource_monitor_v2_test.go | 19 ++++++++----------- 5 files changed, 16 insertions(+), 52 deletions(-) diff --git a/docs/data-sources/monitor_v2.md b/docs/data-sources/monitor_v2.md index 405d8be5..9b6f8054 100644 --- a/docs/data-sources/monitor_v2.md +++ b/docs/data-sources/monitor_v2.md @@ -385,18 +385,8 @@ Read-Only: Read-Only: -- `interval` (Block List) Should be used to run explicit ad-hoc queries. (see [below for nested schema](#nestedblock--scheduling--interval)) - `transform` (Block List) Should be used to defer scheduling to the transformer and evaluate when data becomes available. (see [below for nested schema](#nestedblock--scheduling--transform)) - -### Nested Schema for `scheduling.interval` - -Read-Only: - -- `interval` (String) How often the monitor should attempt to run. -- `randomize` (String) A maximum +/- to apply to the interval to avoid things like harmonics and work stacking up in parallel. - - ### Nested Schema for `scheduling.transform` diff --git a/observe/data_source_monitor_v2.go b/observe/data_source_monitor_v2.go index a9a4df9a..b02283ec 100644 --- a/observe/data_source_monitor_v2.go +++ b/observe/data_source_monitor_v2.go @@ -205,26 +205,6 @@ func dataSourceMonitorV2() *schema.Resource { Description: descriptions.Get("monitorv2", "schema", "scheduling", "description"), Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ - "interval": { // MonitorV2IntervalScheduleInput - Type: schema.TypeList, - Optional: true, - Computed: true, - Description: descriptions.Get("monitorv2", "schema", "scheduling", "interval", "description"), - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "interval": { // Duration! - Type: schema.TypeString, - Computed: true, - Description: descriptions.Get("monitorv2", "schema", "scheduling", "interval", "interval"), - }, - "randomize": { // Duration! - Type: schema.TypeString, - Computed: true, - Description: descriptions.Get("monitorv2", "schema", "scheduling", "interval", "randomize"), - }, - }, - }, - }, "transform": { // MonitorV2TransformScheduleInput Type: schema.TypeList, Optional: true, diff --git a/observe/data_source_monitor_v2_test.go b/observe/data_source_monitor_v2_test.go index e2e2225e..7abe49e8 100644 --- a/observe/data_source_monitor_v2_test.go +++ b/observe/data_source_monitor_v2_test.go @@ -64,8 +64,7 @@ func TestAccObserveGetIDMonitorV2CountData(t *testing.T) { resource.TestCheckResourceAttr("data.observe_monitor_v2.lookup", "rules.0.level", "informational"), resource.TestCheckResourceAttr("data.observe_monitor_v2.lookup", "rules.0.count.0.compare_values.0.compare_fn", "greater"), resource.TestCheckResourceAttr("data.observe_monitor_v2.lookup", "rules.0.count.0.compare_values.0.value_int64.0", "0"), - resource.TestCheckResourceAttr("data.observe_monitor_v2.lookup", "scheduling.0.interval.0.interval", "15m0s"), - resource.TestCheckResourceAttr("data.observe_monitor_v2.lookup", "scheduling.0.interval.0.randomize", "0s"), + resource.TestCheckResourceAttr("data.observe_monitor_v2.lookup", "scheduling.0.transform.0.freshness_goal", "15m0s"), ), }, }, @@ -124,8 +123,7 @@ func TestAccObserveGetIDMonitorV2Threshold(t *testing.T) { resource.TestCheckResourceAttr("data.observe_monitor_v2.lookup", "rules.0.threshold.0.compare_values.0.value_int64.0", "0"), resource.TestCheckResourceAttr("data.observe_monitor_v2.lookup", "rules.0.threshold.0.value_column_name", "temp_number"), resource.TestCheckResourceAttr("data.observe_monitor_v2.lookup", "rules.0.threshold.0.aggregation", "all_of"), - resource.TestCheckResourceAttr("data.observe_monitor_v2.lookup", "scheduling.0.interval.0.interval", "15m0s"), - resource.TestCheckResourceAttr("data.observe_monitor_v2.lookup", "scheduling.0.interval.0.randomize", "0s"), + resource.TestCheckResourceAttr("data.observe_monitor_v2.lookup", "scheduling.0.transform.0.freshness_goal", "15m0s"), ), }, }, @@ -145,7 +143,7 @@ func TestAccObserveGetIDMonitorV2Promote(t *testing.T) { workspace = data.observe_workspace.default.oid rule_kind = "promote" name = "%[1]s" - lookback_time = "10s" + lookback_time = "0s" inputs = { "test" = observe_datastream.test.dataset } @@ -182,14 +180,13 @@ func TestAccObserveGetIDMonitorV2Promote(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrSet("data.observe_monitor_v2.lookup", "workspace"), resource.TestCheckResourceAttr("data.observe_monitor_v2.lookup", "name", randomPrefix), - resource.TestCheckResourceAttr("data.observe_monitor_v2.lookup", "lookback_time", "10s"), + resource.TestCheckResourceAttr("data.observe_monitor_v2.lookup", "lookback_time", "0s"), resource.TestCheckResourceAttr("data.observe_monitor_v2.lookup", "rule_kind", "promote"), resource.TestCheckResourceAttr("data.observe_monitor_v2.lookup", "rules.0.level", "informational"), resource.TestCheckResourceAttr("data.observe_monitor_v2.lookup", "rules.0.promote.0.compare_columns.0.compare_values.0.compare_fn", "greater"), resource.TestCheckResourceAttr("data.observe_monitor_v2.lookup", "rules.0.promote.0.compare_columns.0.compare_values.0.value_int64.0", "1"), resource.TestCheckResourceAttr("data.observe_monitor_v2.lookup", "rules.0.promote.0.compare_columns.0.column.0.column_path.0.name", "temp_number"), - resource.TestCheckResourceAttr("data.observe_monitor_v2.lookup", "scheduling.0.interval.0.interval", "15m0s"), - resource.TestCheckResourceAttr("data.observe_monitor_v2.lookup", "scheduling.0.interval.0.randomize", "0s"), + resource.TestCheckResourceAttr("data.observe_monitor_v2.lookup", "scheduling.0.transform.0.freshness_goal", "15m0s"), ), }, }, diff --git a/observe/resource_monitor_v2_action_test.go b/observe/resource_monitor_v2_action_test.go index b73a6815..870d198d 100644 --- a/observe/resource_monitor_v2_action_test.go +++ b/observe/resource_monitor_v2_action_test.go @@ -47,7 +47,7 @@ func TestAccObserveMonitorV2ActionEmail(t *testing.T) { } scheduling { transform { - freshness_target = "15m" + freshness_goal = "15m" } } actions { @@ -131,7 +131,7 @@ func TestAccObserveMonitorV2ActionWebhook(t *testing.T) { } scheduling { transform { - freshness_target = "15m" + freshness_goal = "15m" } } actions { @@ -215,7 +215,7 @@ func TestAccObserveMonitorV2MultipleActionsEmail(t *testing.T) { } scheduling { transform { - freshness_target = "15m" + freshness_goal = "15m" } } actions { diff --git a/observe/resource_monitor_v2_test.go b/observe/resource_monitor_v2_test.go index 448d971b..d4a998b3 100644 --- a/observe/resource_monitor_v2_test.go +++ b/observe/resource_monitor_v2_test.go @@ -49,7 +49,7 @@ func TestAccObserveMonitorV2Count(t *testing.T) { } scheduling { transform { - freshness_target = "15m" + freshness_goal= "15m" } } } @@ -62,8 +62,7 @@ func TestAccObserveMonitorV2Count(t *testing.T) { resource.TestCheckResourceAttr("observe_monitor_v2.first", "rules.0.level", "informational"), resource.TestCheckResourceAttr("observe_monitor_v2.first", "rules.0.count.0.compare_values.0.compare_fn", "greater"), resource.TestCheckResourceAttr("observe_monitor_v2.first", "rules.0.count.0.compare_values.0.value_int64.0", "0"), - resource.TestCheckResourceAttr("observe_monitor_v2.first", "scheduling.0.interval.0.interval", "15m0s"), - resource.TestCheckResourceAttr("observe_monitor_v2.first", "scheduling.0.interval.0.randomize", "0s"), + resource.TestCheckResourceAttr("observe_monitor_v2.first", "scheduling.0.transform.0.freshness_goal", "15m0s"), ), }, }, @@ -103,7 +102,7 @@ func TestAccObserveMonitorV2Threshold(t *testing.T) { } scheduling { transform { - freshness_target = "15m" + freshness_goal = "15m" } } } @@ -118,8 +117,7 @@ func TestAccObserveMonitorV2Threshold(t *testing.T) { resource.TestCheckResourceAttr("observe_monitor_v2.first", "rules.0.threshold.0.compare_values.0.value_int64.0", "0"), resource.TestCheckResourceAttr("observe_monitor_v2.first", "rules.0.threshold.0.value_column_name", "temp_number"), resource.TestCheckResourceAttr("observe_monitor_v2.first", "rules.0.threshold.0.aggregation", "all_of"), - resource.TestCheckResourceAttr("observe_monitor_v2.first", "scheduling.0.interval.0.interval", "15m0s"), - resource.TestCheckResourceAttr("observe_monitor_v2.first", "scheduling.0.interval.0.randomize", "0s"), + resource.TestCheckResourceAttr("observe_monitor_v2.first", "scheduling.0.transform.0.freshness_goal", "15m0s"), ), }, }, @@ -139,7 +137,7 @@ func TestAccObserveMonitorV2Promote(t *testing.T) { workspace = data.observe_workspace.default.oid rule_kind = "promote" name = "%[1]s" - lookback_time = "10s" + lookback_time = "0s" inputs = { "test" = observe_datastream.test.dataset } @@ -164,7 +162,7 @@ func TestAccObserveMonitorV2Promote(t *testing.T) { } scheduling { transform { - freshness_target = "15m" + freshness_goal= "15m" } } } @@ -172,14 +170,13 @@ func TestAccObserveMonitorV2Promote(t *testing.T) { Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrSet("observe_monitor_v2.first", "workspace"), resource.TestCheckResourceAttr("observe_monitor_v2.first", "name", randomPrefix), - resource.TestCheckResourceAttr("observe_monitor_v2.first", "lookback_time", "10s"), + resource.TestCheckResourceAttr("observe_monitor_v2.first", "lookback_time", "0s"), resource.TestCheckResourceAttr("observe_monitor_v2.first", "rule_kind", "promote"), resource.TestCheckResourceAttr("observe_monitor_v2.first", "rules.0.level", "informational"), resource.TestCheckResourceAttr("observe_monitor_v2.first", "rules.0.promote.0.compare_columns.0.compare_values.0.compare_fn", "greater"), resource.TestCheckResourceAttr("observe_monitor_v2.first", "rules.0.promote.0.compare_columns.0.compare_values.0.value_int64.0", "1"), resource.TestCheckResourceAttr("observe_monitor_v2.first", "rules.0.promote.0.compare_columns.0.column.0.column_path.0.name", "temp_number"), - resource.TestCheckResourceAttr("observe_monitor_v2.first", "scheduling.0.interval.0.interval", "15m0s"), - resource.TestCheckResourceAttr("observe_monitor_v2.first", "scheduling.0.interval.0.randomize", "0s"), + resource.TestCheckResourceAttr("observe_monitor_v2.first", "scheduling.0.transform.0.freshness_goal", "15m0s"), ), }, },