diff --git a/datadog/tests/cassettes/TestAccDatadogDomainAllowlist_CreateUpdate.freeze b/datadog/tests/cassettes/TestAccDatadogDomainAllowlist_CreateUpdate.freeze index 13cc1e5ed..b966a4882 100644 --- a/datadog/tests/cassettes/TestAccDatadogDomainAllowlist_CreateUpdate.freeze +++ b/datadog/tests/cassettes/TestAccDatadogDomainAllowlist_CreateUpdate.freeze @@ -1 +1 @@ -2024-11-01T11:24:51.162193-04:00 \ No newline at end of file +2024-11-06T12:01:45.413918-05:00 \ No newline at end of file diff --git a/datadog/tests/cassettes/TestAccDatadogDomainAllowlist_CreateUpdate.yaml b/datadog/tests/cassettes/TestAccDatadogDomainAllowlist_CreateUpdate.yaml index 19c988c84..65324b287 100644 --- a/datadog/tests/cassettes/TestAccDatadogDomainAllowlist_CreateUpdate.yaml +++ b/datadog/tests/cassettes/TestAccDatadogDomainAllowlist_CreateUpdate.yaml @@ -38,7 +38,7 @@ interactions: - application/json status: 200 OK code: 200 - duration: 206.149625ms + duration: 179.44725ms - id: 1 request: proto: HTTP/1.1 @@ -67,14 +67,122 @@ interactions: content_length: -1 uncompressed: true body: | - {"data":{"type":"domain_allowlist","attributes":{"enabled":true,"domains":[]}}} + {"data":{"type":"domain_allowlist","attributes":{"enabled":true,"domains":["@test.com","@datadoghq.com"]}}} headers: Content-Type: - application/json status: 200 OK code: 200 - duration: 99.865875ms + duration: 74.813583ms - id: 2 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.datadoghq.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Accept: + - application/json + url: https://api.datadoghq.com/api/v2/domain_allowlist + method: GET + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: + - chunked + trailer: {} + content_length: -1 + uncompressed: true + body: | + {"data":{"type":"domain_allowlist","attributes":{"enabled":true,"domains":["@test.com","@datadoghq.com"]}}} + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 84.83025ms + - id: 3 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 110 + transfer_encoding: [] + trailer: {} + host: api.datadoghq.com + remote_addr: "" + request_uri: "" + body: | + {"data":{"attributes":{"domains":["@gmail.com","@datadoghq.com"],"enabled":false},"type":"domain_allowlist"}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + url: https://api.datadoghq.com/api/v2/domain_allowlist + method: PATCH + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: + - chunked + trailer: {} + content_length: -1 + uncompressed: true + body: | + {"data":{"type":"domain_allowlist","attributes":{"enabled":false,"domains":["@gmail.com","@datadoghq.com"]}}} + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 149.79325ms + - id: 4 + request: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + content_length: 0 + transfer_encoding: [] + trailer: {} + host: api.datadoghq.com + remote_addr: "" + request_uri: "" + body: "" + form: {} + headers: + Accept: + - application/json + url: https://api.datadoghq.com/api/v2/domain_allowlist + method: GET + response: + proto: HTTP/1.1 + proto_major: 1 + proto_minor: 1 + transfer_encoding: + - chunked + trailer: {} + content_length: -1 + uncompressed: true + body: | + {"data":{"type":"domain_allowlist","attributes":{"enabled":false,"domains":["@gmail.com","@datadoghq.com"]}}} + headers: + Content-Type: + - application/json + status: 200 OK + code: 200 + duration: 87.818833ms + - id: 5 request: proto: HTTP/1.1 proto_major: 1 @@ -105,14 +213,14 @@ interactions: content_length: -1 uncompressed: true body: | - {"data":{"type":"domain_allowlist","attributes":{"enabled":true,"domains":[]}}} + {"data":{"type":"domain_allowlist","attributes":{"enabled":false,"domains":[]}}} headers: Content-Type: - application/json status: 200 OK code: 200 - duration: 130.390042ms - - id: 3 + duration: 146.024083ms + - id: 6 request: proto: HTTP/1.1 proto_major: 1 @@ -140,10 +248,10 @@ interactions: content_length: -1 uncompressed: true body: | - {"data":{"type":"domain_allowlist","attributes":{"enabled":true,"domains":[]}}} + {"data":{"type":"domain_allowlist","attributes":{"enabled":false,"domains":[]}}} headers: Content-Type: - application/json status: 200 OK code: 200 - duration: 103.107417ms + duration: 86.334041ms diff --git a/datadog/tests/resource_datadog_domain_allowlist_test.go b/datadog/tests/resource_datadog_domain_allowlist_test.go index 3f1521e24..272a2283e 100644 --- a/datadog/tests/resource_datadog_domain_allowlist_test.go +++ b/datadog/tests/resource_datadog_domain_allowlist_test.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "testing" - "time" "github.com/hashicorp/terraform-plugin-testing/helper/resource" "github.com/hashicorp/terraform-plugin-testing/terraform" @@ -17,6 +16,8 @@ func TestAccDatadogDomainAllowlist_CreateUpdate(t *testing.T) { _, providers, accProviders := testAccFrameworkMuxProviders(context.Background(), t) + // When generating the casette, it may be necessary to add sleep functions before the check + // The endpoint has a zonal cache with a ttl of 2 second resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, ProtoV5ProviderFactories: accProviders, @@ -31,8 +32,7 @@ func TestAccDatadogDomainAllowlist_CreateUpdate(t *testing.T) { ), }, { - PreConfig: func() { time.Sleep(time.Second) }, - Config: testAccCheckDatadogDomainAllowlistConfigUpdated(), + Config: testAccCheckDatadogDomainAllowlistConfigUpdated(), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttr("datadog_domain_allowlist.foo", "domains.0", "@gmail.com"), resource.TestCheckResourceAttr("datadog_domain_allowlist.foo", "domains.1", "@datadoghq.com"),