Skip to content

Commit

Permalink
add deletion_protection=false to tests with sql_database_instance (#4096
Browse files Browse the repository at this point in the history
) (#7508)

* add deletion_protection=false to tests with sql_database_instance

* ignore deletion_protection on datasource test

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Oct 13, 2020
1 parent d2f32d3 commit 71c2368
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .changelog/4096.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
2 changes: 2 additions & 0 deletions google/data_source_google_sql_ca_certs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ resource "google_sql_database_instance" "foo" {
tier = "db-f1-micro"
crash_safe_replication = false
}
deletion_protection = false
}
data "google_sql_ca_certs" "ca_certs" {
Expand Down
10 changes: 9 additions & 1 deletion google/data_source_sql_database_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ func TestAccDataSourceSqlDatabaseInstance_basic(t *testing.T) {
{
Config: testAccDataSourceSqlDatabaseInstance_basic(context),
Check: resource.ComposeTestCheckFunc(
checkDataSourceStateMatchesResourceState("data.google_sql_database_instance.qa", "google_sql_database_instance.master"),
checkDataSourceStateMatchesResourceStateWithIgnores(
"data.google_sql_database_instance.qa",
"google_sql_database_instance.master",
map[string]struct{}{
"deletion_protection": {},
},
),
),
},
},
Expand All @@ -39,6 +45,8 @@ resource "google_sql_database_instance" "master" {
# type. See argument reference below.
tier = "db-f1-micro"
}
deletion_protection = false
}
data "google_sql_database_instance" "qa" {
Expand Down
7 changes: 5 additions & 2 deletions google/resource_cloud_run_service_generated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ func TestAccCloudRunService_cloudRunServiceSqlExample(t *testing.T) {
t.Parallel()

context := map[string]interface{}{
"project": getTestProjectFromEnv(),
"random_suffix": randString(t, 10),
"project": getTestProjectFromEnv(),
"deletion_protection": false,
"random_suffix": randString(t, 10),
}

vcrTest(t, resource.TestCase{
Expand Down Expand Up @@ -133,6 +134,8 @@ resource "google_sql_database_instance" "instance" {
settings {
tier = "db-f1-micro"
}
deletion_protection = "%{deletion_protection}"
}
`, context)
}
Expand Down
5 changes: 4 additions & 1 deletion google/resource_sql_database_generated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ func TestAccSQLDatabase_sqlDatabaseBasicExample(t *testing.T) {
t.Parallel()

context := map[string]interface{}{
"random_suffix": randString(t, 10),
"deletion_protection": false,
"random_suffix": randString(t, 10),
}

vcrTest(t, resource.TestCase{
Expand Down Expand Up @@ -63,6 +64,8 @@ resource "google_sql_database_instance" "instance" {
settings {
tier = "db-f1-micro"
}
deletion_protection = "%{deletion_protection}"
}
`, context)
}
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/cloud_run_service.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ resource "google_sql_database_instance" "instance" {
settings {
tier = "db-f1-micro"
}
deletion_protection = "true"
}
```
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/sql_database.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ resource "google_sql_database_instance" "instance" {
settings {
tier = "db-f1-micro"
}
deletion_protection = "true"
}
```

Expand Down

0 comments on commit 71c2368

Please sign in to comment.