Skip to content

Commit eb1a253

Browse files
committed
expanded tests
1 parent 136b746 commit eb1a253

File tree

1 file changed

+42
-3
lines changed

1 file changed

+42
-3
lines changed

mmv1/third_party/terraform/services/memorystore/resource_memorystore_instance_test.go

+42-3
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func TestAccMemorystoreInstance_automatedBackupConfig(t *testing.T) {
5555
}
5656

5757
context_diabled := map[string]interface{}{
58-
"random_suffix": acctest.RandString(t, 10),
58+
"random_suffix": context_enabled["random_suffix"],
5959
"automated_backup_mode": "DISABLED",
6060
}
6161

@@ -87,17 +87,56 @@ func TestAccMemorystoreInstance_automatedBackupConfig(t *testing.T) {
8787
func testAccMemorystoreInstance_automatedBackupConfig(context map[string]interface{}) string {
8888
return acctest.Nprintf(`
8989
// Primary instance
90-
resource "google_memorystore_instance" "primary_instance" {
91-
instance_id = "tf-instance-%{random_suffix}"
90+
resource "google_memorystore_instance" "test-abc" {
91+
instance_id = "tf-test-instance-abc-%{random_suffix}"
9292
shard_count = 1
9393
location = "us-central1"
9494
replica_count = 1
9595
node_type = "SHARED_CORE_NANO"
9696
deletion_protection_enabled = false
97+
desired_psc_auto_connections {
98+
network = google_compute_network.primary_producer_net.id
99+
project_id = data.google_project.project.project_id
100+
}
97101
automated_backup_config {
98102
automated_backup_mode = "%{automated_backup_mode}"
103+
retention = "259200s"
104+
fixed_frequency_schedule {
105+
start_time {
106+
hours = 20
107+
minutes = 30
108+
seconds = 50
109+
nanos = 2
110+
}
111+
}
112+
}
113+
depends_on = [ google_network_connectivity_service_connection_policy.primary_policy ]
114+
}
115+
116+
resource "google_network_connectivity_service_connection_policy" "primary_policy" {
117+
name = "tf-test-abc-policy-%{random_suffix}"
118+
location = "us-central1"
119+
service_class = "gcp-memorystore"
120+
description = "my basic service connection policy"
121+
network = google_compute_network.primary_producer_net.id
122+
psc_config {
123+
subnetworks = [google_compute_subnetwork.primary_producer_subnet.id]
99124
}
125+
}
126+
127+
resource "google_compute_subnetwork" "primary_producer_subnet" {
128+
name = "tf-test-abc-%{random_suffix}"
129+
ip_cidr_range = "10.0.4.0/29"
130+
region = "us-central1"
131+
network = google_compute_network.primary_producer_net.id
132+
}
100133
134+
resource "google_compute_network" "primary_producer_net" {
135+
name = "tf-test-abc-net-%{random_suffix}"
136+
auto_create_subnetworks = false
137+
}
138+
139+
data "google_project" "project" {
101140
}
102141
`, context)
103142
}

0 commit comments

Comments
 (0)