Skip to content

Commit 48c5bee

Browse files
Remove automated backup policy validation test for secondary cluster (#10255) (#7173)
[upstream:cad2a9a67505f72ea895615cde2a41b4c5cf3c5a] Signed-off-by: Modular Magician <[email protected]>
1 parent 99afea8 commit 48c5bee

File tree

2 files changed

+3
-101
lines changed

2 files changed

+3
-101
lines changed

.changelog/10255.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:none
2+
3+
```

google-beta/services/alloydb/resource_alloydb_secondary_cluster_test.go

Lines changed: 0 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -357,107 +357,6 @@ data "google_compute_network" "default" {
357357
`, context)
358358
}
359359

360-
// Test if adding automatedBackupPolicy throws an error as it can not be enabled on secondary cluster
361-
func TestAccAlloydbCluster_secondaryClusterAddAutomatedBackupPolicy(t *testing.T) {
362-
t.Parallel()
363-
364-
context := map[string]interface{}{
365-
"network_name": acctest.BootstrapSharedServiceNetworkingConnection(t, "alloydbinstance-network-config-1"),
366-
"random_suffix": acctest.RandString(t, 10),
367-
"hour": 23,
368-
}
369-
370-
acctest.VcrTest(t, resource.TestCase{
371-
PreCheck: func() { acctest.AccTestPreCheck(t) },
372-
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
373-
CheckDestroy: testAccCheckAlloydbClusterDestroyProducer(t),
374-
Steps: []resource.TestStep{
375-
{
376-
Config: testAccAlloydbCluster_secondaryClusterMandatoryFields(context),
377-
},
378-
{
379-
ResourceName: "google_alloydb_cluster.secondary",
380-
ImportState: true,
381-
ImportStateVerify: true,
382-
ImportStateVerifyIgnore: []string{"initial_user", "restore_backup_source", "restore_continuous_backup_source", "cluster_id", "location", "labels", "annotations", "terraform_labels", "reconciling"},
383-
},
384-
{
385-
// Invalid input check - can not add automated backup policy to a secondary cluster
386-
Config: testAccAlloydbCluster_secondaryClusterAddAutomatedBackupPolicy(context),
387-
ExpectError: regexp.MustCompile("cannot enable automated backups on secondary cluster until it is promoted"),
388-
},
389-
},
390-
})
391-
}
392-
393-
func testAccAlloydbCluster_secondaryClusterAddAutomatedBackupPolicy(context map[string]interface{}) string {
394-
return acctest.Nprintf(`
395-
resource "google_alloydb_cluster" "primary" {
396-
cluster_id = "tf-test-alloydb-primary-cluster%{random_suffix}"
397-
location = "us-central1"
398-
network = data.google_compute_network.default.id
399-
}
400-
401-
resource "google_alloydb_instance" "primary" {
402-
cluster = google_alloydb_cluster.primary.name
403-
instance_id = "tf-test-alloydb-primary-instance%{random_suffix}"
404-
instance_type = "PRIMARY"
405-
406-
machine_config {
407-
cpu_count = 2
408-
}
409-
}
410-
411-
resource "google_alloydb_cluster" "secondary" {
412-
cluster_id = "tf-test-alloydb-secondary-cluster%{random_suffix}"
413-
location = "us-east1"
414-
network = data.google_compute_network.default.id
415-
cluster_type = "SECONDARY"
416-
417-
continuous_backup_config {
418-
enabled = false
419-
}
420-
421-
secondary_config {
422-
primary_cluster_name = google_alloydb_cluster.primary.name
423-
}
424-
425-
automated_backup_policy {
426-
location = "us-central1"
427-
backup_window = "1800s"
428-
enabled = true
429-
430-
weekly_schedule {
431-
days_of_week = ["MONDAY"]
432-
433-
start_times {
434-
hours = %{hour}
435-
minutes = 0
436-
seconds = 0
437-
nanos = 0
438-
}
439-
}
440-
441-
quantity_based_retention {
442-
count = 1
443-
}
444-
445-
labels = {
446-
test = "tf-test-alloydb-secondary-cluster%{random_suffix}"
447-
}
448-
}
449-
450-
depends_on = [google_alloydb_instance.primary]
451-
}
452-
453-
data "google_project" "project" {}
454-
455-
data "google_compute_network" "default" {
456-
name = "%{network_name}"
457-
}
458-
`, context)
459-
}
460-
461360
func TestAccAlloydbCluster_secondaryClusterUsingCMEK(t *testing.T) {
462361
t.Parallel()
463362

0 commit comments

Comments
 (0)