Skip to content

Commit

Permalink
updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tedkahwaji committed Oct 10, 2024
1 parent df57137 commit dcd8423
Show file tree
Hide file tree
Showing 8 changed files with 720 additions and 461 deletions.
11 changes: 6 additions & 5 deletions datadog/fwprovider/resource_datadog_integration_gcp_sts.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ func (r *integrationGcpStsResource) Create(ctx context.Context, request resource
integrationGcpStsMutex.Lock()
defer integrationGcpStsMutex.Unlock()

// This resource is special and uses datadog delagate account.
// The datadog delegate account cannot mutated after creation hence it is safe
// This resource is special and uses datadog delegate account.
// The datadog delegate account cannot mutate after creation hence it is safe
// to call MakeGCPSTSDelegate multiple times. And to ensure it is created, we call it once before creating
// gcp sts resource.
delegateResponse, _, err := r.Api.MakeGCPSTSDelegate(r.Auth, *datadogV2.NewMakeGCPSTSDelegateOptionalParameters())
Expand All @@ -180,6 +180,10 @@ func (r *integrationGcpStsResource) Create(ctx context.Context, request resource
state.DelegateAccountEmail = types.StringValue(delegateEmail)

attributes, diags := r.buildIntegrationGcpStsRequestBody(ctx, &state)
if !state.ClientEmail.IsNull() {
attributes.SetClientEmail(state.ClientEmail.ValueString())
}

body := datadogV2.NewGCPSTSServiceAccountCreateRequestWithDefaults()
body.Data = datadogV2.NewGCPSTSServiceAccountDataWithDefaults()
body.Data.SetAttributes(attributes)
Expand Down Expand Up @@ -305,9 +309,6 @@ func (r *integrationGcpStsResource) buildIntegrationGcpStsRequestBody(ctx contex
if !state.Automute.IsNull() {
attributes.SetAutomute(state.Automute.ValueBool())
}
if !state.ClientEmail.IsNull() {
attributes.SetClientEmail(state.ClientEmail.ValueString())
}
if !state.IsCspmEnabled.IsNull() {
attributes.SetIsCspmEnabled(state.IsCspmEnabled.ValueBool())
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-02-01T13:25:10.512584373+01:00
2024-10-10T12:10:22.943852-04:00
915 changes: 594 additions & 321 deletions datadog/tests/cassettes/TestAccDatadogIntegrationGCP.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-01-18T19:18:18.905486+01:00
2024-10-10T14:34:16.041354-04:00
160 changes: 75 additions & 85 deletions datadog/tests/cassettes/TestAccIntegrationGcpStsBasic.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-01-10T15:25:54.984933-05:00
2024-10-10T14:35:07.463306-04:00
88 changes: 41 additions & 47 deletions datadog/tests/cassettes/TestAccIntegrationGcpStsDefault.yaml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions datadog/tests/resource_datadog_integration_gcp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ resource "datadog_integration_gcp" "awesome_gcp_project_integration" {
private_key = "-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
client_email = "%[email protected]"
client_id = "123456789012345678901"
cloud_run_revision_filters = ["tag:one", "tag:two"]
}`, uniq, uniq)
}

Expand Down

0 comments on commit dcd8423

Please sign in to comment.