-
Notifications
You must be signed in to change notification settings - Fork 208
refactor: Uses delete_on_create_timeout with default=true support across TPF resources #3809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c7497f3
5c6f18c
63f827c
468d6a0
c89d6c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -135,7 +135,11 @@ func resourceSchema(ctx context.Context) schema.Schema { | |
| MarkdownDescription: "Date and time when MongoDB Cloud created this cluster. This parameter expresses its value in ISO 8601 format in UTC.", | ||
| }, | ||
| "delete_on_create_timeout": schema.BoolAttribute{ | ||
| Optional: true, | ||
| Computed: true, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see we're adding There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually this PR improves that behavior by showing the planned |
||
| Optional: true, | ||
| PlanModifiers: []planmodifier.Bool{ | ||
| customplanmodifier.CreateOnlyBoolWithDefault(true), | ||
| }, | ||
| MarkdownDescription: "Indicates whether to delete the resource being created if a timeout is reached when waiting for completion. When set to `true` and timeout occurs, it triggers the deletion and returns immediately without waiting for deletion to complete. When set to `false`, the timeout will not trigger resource deletion. If you suspect a transient error when the value is `true`, wait before retrying to allow resource deletion to finish. Default is `true`.", | ||
| }, | ||
| "encryption_at_rest_provider": schema.StringAttribute{ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,13 +21,13 @@ const ( | |
| dataSourceID = "data.mongodbatlas_search_deployment.test" | ||
| ) | ||
|
|
||
| func importStep(tfConfig string) resource.TestStep { | ||
| func importStep() resource.TestStep { | ||
| return resource.TestStep{ | ||
| Config: tfConfig, | ||
| ResourceName: resourceID, | ||
| ImportStateIdFunc: importStateIDFunc(resourceID), | ||
| ImportState: true, | ||
| ImportStateVerify: true, | ||
| ResourceName: resourceID, | ||
| ImportStateIdFunc: importStateIDFunc(resourceID), | ||
| ImportState: true, | ||
| ImportStateVerify: true, | ||
| ImportStateVerifyIgnore: []string{"delete_on_create_timeout"}, | ||
| } | ||
| } | ||
| func TestAccSearchDeployment_basic(t *testing.T) { | ||
|
|
@@ -48,9 +48,10 @@ func TestAccSearchDeployment_basic(t *testing.T) { | |
| Config: updateStepNoWait, | ||
| Check: updateStep.Check, | ||
| }, | ||
| // Changes: skip_wait_on_update true -> null | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This summarizes the change in behavior well. This is why we need the Note: A fresh import and setting |
||
| // skip_wait_on_update = false again, and wait for stable state_name | ||
| updateStep, | ||
| importStep(updateStep.Config), | ||
|
|
||
| importStep(), | ||
| }, | ||
| }) | ||
| } | ||
|
|
@@ -109,17 +110,17 @@ func TestAccSearchDeployment_timeoutTest(t *testing.T) { | |
| ), | ||
| }, | ||
| { | ||
| Config: configWithTimeout(timeoutsStrLongFalse), | ||
| Check: resource.TestCheckResourceAttr(resourceID, "delete_on_create_timeout", "false"), | ||
| Config: configWithTimeout(timeoutsStrLongFalse), | ||
| ExpectError: regexp.MustCompile("delete_on_create_timeout cannot be updated or set after import.*"), | ||
| }, | ||
| { | ||
| Config: configWithTimeout(""), | ||
| Check: resource.ComposeAggregateTestCheckFunc( | ||
| resource.TestCheckNoResourceAttr(resourceID, "delete_on_create_timeout"), | ||
| resource.TestCheckResourceAttrSet(resourceID, "delete_on_create_timeout"), // Will keep value from state | ||
| resource.TestCheckNoResourceAttr(resourceID, "timeouts.create"), | ||
| ), | ||
| }, | ||
| importStep(configWithTimeout("")), | ||
| importStep(), | ||
| }, | ||
| }) | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,16 @@ var ( | |
| testLogDestConfig = connectionConfig{connectionType: connTypeTestLog, pipelineStepIsSource: false} | ||
| ) | ||
|
|
||
| func importStep() resource.TestStep { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can be a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i normally prefer functions to global vars, which is safer in case the var is modified later and might affect other tests. (some exceptions apply, e.g. for an array of strings, if we're sure they're not modified) |
||
| return resource.TestStep{ | ||
| ResourceName: resourceName, | ||
| ImportStateIdFunc: importStateIDFunc(resourceName), | ||
| ImportState: true, | ||
| ImportStateVerify: true, | ||
| ImportStateVerifyIgnore: []string{"delete_on_create_timeout", "stats"}, | ||
| } | ||
| } | ||
|
|
||
| func TestAccStreamProcessor_basic(t *testing.T) { | ||
| resource.ParallelTest(t, *basicTestCase(t)) | ||
| } | ||
|
|
@@ -66,13 +76,7 @@ func basicTestCase(t *testing.T) *resource.TestCase { | |
| Check: composeStreamProcessorChecks(projectID, workspaceName, processorName, streamprocessor.StartedState, true, false), | ||
| ConfigStateChecks: pluralConfigStateChecks(processorName, streamprocessor.StartedState, workspaceName, true, false), | ||
| }, | ||
| { | ||
| ResourceName: resourceName, | ||
| ImportStateIdFunc: importStateIDFunc(resourceName), | ||
| ImportState: true, | ||
| ImportStateVerify: true, | ||
| ImportStateVerifyIgnore: []string{"stats"}, | ||
| }, | ||
| importStep(), | ||
| }} | ||
| } | ||
|
|
||
|
|
@@ -150,13 +154,7 @@ func TestAccStreamProcessor_withOptions(t *testing.T) { | |
| Check: composeStreamProcessorChecks(projectID, workspaceName, processorName, streamprocessor.CreatedState, false, true), | ||
| ConfigStateChecks: pluralConfigStateChecks(processorName, streamprocessor.CreatedState, workspaceName, false, true), | ||
| }, | ||
| { | ||
| ResourceName: resourceName, | ||
| ImportStateIdFunc: importStateIDFunc(resourceName), | ||
| ImportState: true, | ||
| ImportStateVerify: true, | ||
| ImportStateVerifyIgnore: []string{"stats"}, | ||
| }, | ||
| importStep(), | ||
| }}) | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can
plan.DeleteOnCreateTimeoutbe null?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it has a default value of
true