Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
skarimo committed Oct 6, 2023
1 parent 894ea3e commit 1e32239
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2023-10-06T15:07:19.795264-04:00
104 changes: 104 additions & 0 deletions datadog/tests/cassettes/TestAccDatadogServiceDefinition_BasicV2_2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
---
version: 1
interactions:
- request:
body: "schema-version: v2.2\ndd-service: tf-testaccdatadogservicedefinition_basicv2_2-local-1696619239\ncontacts:\n - contact: [email protected]\n name: Team Email\n type: email\nextensions:\n myorgextension: extensionvalue\nintegrations:\n opsgenie:\n region: US\n service-url: https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000\n pagerduty:\n service-url: https://my-org.pagerduty.com/service-directory/PMyService\nlinks:\n - name: Architecture\n type: doc\n provider: Gigoogle drivetHub\n url: https://my-runbook\n - name: Runbook\n type: runbook\n url: https://my-runbook\n - name: Source Code\n type: repo\n provider: GitHub\n url: https://github.com/DataDog/schema\ntags:\n - my:tag\n - service:tag\nteam: my-team \nlanguages:\n - go\n - python\nservice-type: web\n"
form: {}
headers:
Content-Type:
- application/json
url: https://api.datadoghq.com/api/v2/services/definitions
method: POST
response:
body: |
{"data":[{"type":"service-definition","attributes":{"meta":{"last-modified-time":"2023-10-06T19:07:21.086499009Z","github-html-url":"","ingestion-source":"api","origin":"dd_terraform","origin-detail":"","warnings":[],"ingested-schema-version":"v2.2"},"schema":{"schema-version":"v2.2","dd-service":"tf-testaccdatadogservicedefinition_basicv2_2-local-1696619239","team":"my-team","contacts":[{"name":"Team Email","type":"email","contact":"[email protected]"}],"links":[{"name":"Architecture","type":"doc","provider":"Gigoogle drivetHub","url":"https://my-runbook"},{"name":"Runbook","type":"runbook","url":"https://my-runbook"},{"name":"Source Code","type":"repo","provider":"GitHub","url":"https://github.com/DataDog/schema"}],"tags":["my:tag","service:tag"],"integrations":{"pagerduty":{"service-url":"https://my-org.pagerduty.com/service-directory/PMyService"},"opsgenie":{"service-url":"https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000","region":"US"}},"extensions":{"myorgextension":"extensionvalue"},"service-type":"web","languages":["go","python"]}}}]}
headers:
Content-Type:
- application/json
status: 200 OK
code: 200
duration: ""
- request:
body: ""
form: {}
headers:
Content-Type:
- application/json
url: https://api.datadoghq.com/api/v2/services/definitions/tf-testaccdatadogservicedefinition_basicv2_2-local-1696619239
method: GET
response:
body: |
{"errors":["Not Found"],"error_details":[{}]}
headers:
Content-Type:
- application/json
status: 404 Not Found
code: 404
duration: ""
- request:
body: ""
form: {}
headers:
Content-Type:
- application/json
url: https://api.datadoghq.com/api/v2/services/definitions/tf-testaccdatadogservicedefinition_basicv2_2-local-1696619239
method: GET
response:
body: |
{"data":{"type":"service-definition","id":"39c14f488ab7a1f6b54c0641478beb77","attributes":{"meta":{"last-modified-time":"2023-10-06T19:07:21Z","github-html-url":"","ingestion-source":"api","origin":"dd_terraform","origin-detail":"","warnings":[],"ingested-schema-version":"v2.2"},"schema":{"schema-version":"v2.2","dd-service":"tf-testaccdatadogservicedefinition_basicv2_2-local-1696619239","team":"my-team","contacts":[{"name":"Team Email","type":"email","contact":"[email protected]"}],"links":[{"name":"Architecture","type":"doc","provider":"Gigoogle drivetHub","url":"https://my-runbook"},{"name":"Runbook","type":"runbook","url":"https://my-runbook"},{"name":"Source Code","type":"repo","provider":"GitHub","url":"https://github.com/DataDog/schema"}],"tags":["my:tag","service:tag"],"integrations":{"pagerduty":{"service-url":"https://my-org.pagerduty.com/service-directory/PMyService"},"opsgenie":{"service-url":"https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000","region":"US"}},"extensions":{"myorgextension":"extensionvalue"},"service-type":"web","languages":["go","python"]}}}}
headers:
Content-Type:
- application/json
status: 200 OK
code: 200
duration: ""
- request:
body: ""
form: {}
headers:
Content-Type:
- application/json
url: https://api.datadoghq.com/api/v2/services/definitions/tf-testaccdatadogservicedefinition_basicv2_2-local-1696619239
method: GET
response:
body: |
{"data":{"type":"service-definition","id":"39c14f488ab7a1f6b54c0641478beb77","attributes":{"meta":{"last-modified-time":"2023-10-06T19:07:21Z","github-html-url":"","ingestion-source":"api","origin":"dd_terraform","origin-detail":"","warnings":[],"ingested-schema-version":"v2.2"},"schema":{"schema-version":"v2.2","dd-service":"tf-testaccdatadogservicedefinition_basicv2_2-local-1696619239","team":"my-team","contacts":[{"name":"Team Email","type":"email","contact":"[email protected]"}],"links":[{"name":"Architecture","type":"doc","provider":"Gigoogle drivetHub","url":"https://my-runbook"},{"name":"Runbook","type":"runbook","url":"https://my-runbook"},{"name":"Source Code","type":"repo","provider":"GitHub","url":"https://github.com/DataDog/schema"}],"tags":["my:tag","service:tag"],"integrations":{"pagerduty":{"service-url":"https://my-org.pagerduty.com/service-directory/PMyService"},"opsgenie":{"service-url":"https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000","region":"US"}},"extensions":{"myorgextension":"extensionvalue"},"service-type":"web","languages":["go","python"]}}}}
headers:
Content-Type:
- application/json
status: 200 OK
code: 200
duration: ""
- request:
body: ""
form: {}
headers:
Content-Type:
- application/json
url: https://api.datadoghq.com/api/v2/services/definitions/tf-testaccdatadogservicedefinition_basicv2_2-local-1696619239
method: DELETE
response:
body: ""
headers:
Content-Type:
- text/html; charset=utf-8
status: 204 No Content
code: 204
duration: ""
- request:
body: ""
form: {}
headers:
Content-Type:
- application/json
url: https://api.datadoghq.com/api/v2/services/definitions/tf-testaccdatadogservicedefinition_basicv2_2-local-1696619239
method: GET
response:
body: |
{"data":{"type":"service-definition","id":"39c14f488ab7a1f6b54c0641478beb77","attributes":{"meta":{"last-modified-time":"2023-10-06T19:07:21Z","github-html-url":"","ingestion-source":"api","origin":"dd_terraform","origin-detail":"","warnings":[],"ingested-schema-version":"v2.2"},"schema":{"schema-version":"v2.2","dd-service":"tf-testaccdatadogservicedefinition_basicv2_2-local-1696619239","team":"my-team","contacts":[{"name":"Team Email","type":"email","contact":"[email protected]"}],"links":[{"name":"Architecture","type":"doc","provider":"Gigoogle drivetHub","url":"https://my-runbook"},{"name":"Runbook","type":"runbook","url":"https://my-runbook"},{"name":"Source Code","type":"repo","provider":"GitHub","url":"https://github.com/DataDog/schema"}],"tags":["my:tag","service:tag"],"integrations":{"pagerduty":{"service-url":"https://my-org.pagerduty.com/service-directory/PMyService"},"opsgenie":{"service-url":"https://my-org.opsgenie.com/service/123e4567-e89b-12d3-a456-426614174000","region":"US"}},"extensions":{"myorgextension":"extensionvalue"},"service-type":"web","languages":["go","python"]}}}}
headers:
Content-Type:
- application/json
status: 200 OK
code: 200
duration: ""
19 changes: 19 additions & 0 deletions datadog/tests/resource_datadog_service_definition_yaml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,25 @@ func TestAccDatadogServiceDefinition_BasicV2_1(t *testing.T) {
})
}

func TestAccDatadogServiceDefinition_BasicV2_2(t *testing.T) {
t.Parallel()
ctx, accProviders := testAccProviders(context.Background(), t)
uniq := strings.ToLower(uniqueEntityName(ctx, t))
accProvider := testAccProvider(t, accProviders)

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProviderFactories: accProviders,
CheckDestroy: testAccCheckDatadogServiceDefinitionDestroy(accProvider),
Steps: []resource.TestStep{
{
Config: testAccCheckDatadogServiceDefinitionV2_2(uniq),
Check: checkServiceDefinitionExists(accProvider),
},
},
})
}

func TestAccDatadogServiceDefinition_BasicBackstage(t *testing.T) {
t.Parallel()
ctx, accProviders := testAccProviders(context.Background(), t)
Expand Down

0 comments on commit 1e32239

Please sign in to comment.