Skip to content

Commit 84baddb

Browse files
authored
fix downtime test (#1549)
1 parent d8a679f commit 84baddb

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

datadog/tests/provider_test.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -506,14 +506,6 @@ func buildContext(ctx context.Context, apiKey string, appKey string, apiURL stri
506506
func buildDatadogClient(httpClient *http.Client) *common.APIClient {
507507
//Datadog API config.HTTPClient
508508
config := common.NewConfiguration()
509-
config.SetUnstableOperationEnabled("v1.CreateSLOCorrection", true)
510-
config.SetUnstableOperationEnabled("v1.GetSLOCorrection", true)
511-
config.SetUnstableOperationEnabled("v1.UpdateSLOCorrection", true)
512-
config.SetUnstableOperationEnabled("v1.DeleteSLOCorrection", true)
513-
config.SetUnstableOperationEnabled("v2.CreateTagConfiguration", true)
514-
config.SetUnstableOperationEnabled("v2.DeleteTagConfiguration", true)
515-
config.SetUnstableOperationEnabled("v2.ListTagConfigurationByName", true)
516-
config.SetUnstableOperationEnabled("v2.UpdateTagConfiguration", true)
517509
config.Debug = isDebug()
518510
config.HTTPClient = httpClient
519511
config.UserAgent = utils.GetUserAgent(config.UserAgent)
@@ -666,7 +658,8 @@ func testCheckResourceAttrs(name string, checkExists resource.TestCheckFunc, ass
666658
return funcs
667659
}
668660

669-
/* Utility method for Debugging purpose. This method helps list assertions as well
661+
/*
662+
Utility method for Debugging purpose. This method helps list assertions as well
670663
It is a duplication of `resource.TestCheckResourceAttr` into which we added print statements.
671664
*/
672665
func CheckResourceAttr(name, key, value string) resource.TestCheckFunc {

datadog/tests/resource_datadog_downtime_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ func datadogDowntimeDestroyHelper(ctx context.Context, s *terraform.State, apiIn
792792
return nil
793793
}
794794
return &utils.FatalError{Prob: fmt.Sprintf("received an error retrieving Downtime %s", err)}
795-
} else if !dt.GetActive() {
795+
} else if canceled, ok := dt.GetCanceledOk(); !dt.GetActive() || (ok && canceled != nil) {
796796
// Datadog only cancels downtime on DELETE so if its not Active, its deleted
797797
return nil
798798
}

0 commit comments

Comments
 (0)