Skip to content

Commit 54e2ad2

Browse files
committed
test: fixing tests
1 parent a3bd3c1 commit 54e2ad2

File tree

1 file changed

+72
-34
lines changed

1 file changed

+72
-34
lines changed

provider/rediscloud_active_active_subscription_test.go

Lines changed: 72 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func TestAccResourceRedisCloudActiveActiveSubscription_CRUDI(t *testing.T) {
3838
CheckDestroy: testAccCheckActiveActiveSubscriptionDestroy,
3939
Steps: []resource.TestStep{
4040
{
41-
Config: fmt.Sprintf(testAccResourceRedisCloudActiveActiveSubscription, name),
41+
Config: fmt.Sprintf(testAccResourceRedisCloudActiveActiveSubscription, name, name),
4242
Check: resource.ComposeAggregateTestCheckFunc(
4343
// Test the resource
4444
resource.TestCheckResourceAttr(resourceName, "name", name),
@@ -165,9 +165,11 @@ func TestAccResourceRedisCloudActiveActiveSubscription_CRUDI(t *testing.T) {
165165
// Test the region datasource
166166

167167
resource.TestCheckResourceAttr(datasourceRegionName, "subscription_name", name),
168+
resource.TestCheckResourceAttrSet(datasourceRegionName, "regions.0.regionId"),
168169
resource.TestCheckResourceAttr(datasourceRegionName, "regions.0.region", "us-east-1"),
169170
resource.TestCheckResourceAttr(datasourceRegionName, "regions.0.networking_deployment_cidr", "192.168.0.0/24"),
170171
resource.TestCheckResourceAttrSet(datasourceRegionName, "regions.0.vpc_id"),
172+
resource.TestCheckResourceAttrSet(datasourceRegionName, "regions.1.regionId"),
171173
resource.TestCheckResourceAttr(datasourceRegionName, "regions.1.region", "us-east-2"),
172174
resource.TestCheckResourceAttr(datasourceRegionName, "regions.1.networking_deployment_cidr", "10.0.1.0/24"),
173175
resource.TestCheckResourceAttrSet(datasourceRegionName, "regions.1.vpc_id"),
@@ -346,43 +348,79 @@ data "rediscloud_payment_method" "card" {
346348
}
347349
348350
resource "rediscloud_active_active_subscription" "example" {
349-
name = "%s"
350-
payment_method_id = data.rediscloud_payment_method.card.id
351-
cloud_provider = "AWS"
351+
name = "%s"
352+
payment_method_id = data.rediscloud_payment_method.card.id
353+
cloud_provider = "AWS"
352354
353-
creation_plan {
354-
memory_limit_in_gb = 1
355-
modules = ["RedisJSON"]
356-
quantity = 1
357-
region {
358-
region = "us-east-1"
359-
networking_deployment_cidr = "192.168.0.0/24"
360-
write_operations_per_second = 1000
361-
read_operations_per_second = 1000
362-
}
363-
region {
364-
region = "us-east-2"
365-
networking_deployment_cidr = "10.0.1.0/24"
366-
write_operations_per_second = 1000
367-
read_operations_per_second = 1000
368-
}
369-
}
355+
creation_plan {
356+
memory_limit_in_gb = 1
357+
modules = ["RedisJSON"]
358+
quantity = 1
359+
region {
360+
region = "us-east-1"
361+
networking_deployment_cidr = "192.168.0.0/24"
362+
write_operations_per_second = 1000
363+
read_operations_per_second = 1000
364+
}
365+
region {
366+
region = "us-east-2"
367+
networking_deployment_cidr = "10.0.1.0/24"
368+
write_operations_per_second = 1000
369+
read_operations_per_second = 1000
370+
}
371+
}
370372
371-
maintenance_windows {
372-
mode = "manual"
373-
window {
374-
start_hour = 22
375-
duration_in_hours = 8
376-
days = ["Monday", "Thursday"]
377-
}
378-
window {
379-
start_hour = 12
380-
duration_in_hours = 6
381-
days = ["Friday", "Saturday", "Sunday"]
382-
}
383-
}
373+
maintenance_windows {
374+
mode = "manual"
375+
window {
376+
start_hour = 22
377+
duration_in_hours = 8
378+
days = ["Monday", "Thursday"]
379+
}
380+
window {
381+
start_hour = 12
382+
duration_in_hours = 6
383+
days = ["Friday", "Saturday", "Sunday"]
384+
}
385+
}
384386
}
385387
388+
resource "rediscloud_active_active_subscription_database" "example" {
389+
subscription_id = rediscloud_active_active_subscription.example.id
390+
name = "%s"
391+
dataset_size_in_gb = 1
392+
global_data_persistence = "aof-every-1-second"
393+
global_password = "some-random-pass-2"
394+
global_source_ips = ["192.168.0.0/16"]
395+
global_alert {
396+
name = "dataset-size"
397+
value = 40
398+
}
399+
400+
global_modules = ["RedisJSON"]
401+
402+
override_region {
403+
name = "us-east-2"
404+
override_global_source_ips = ["192.10.0.0/16"]
405+
}
406+
407+
override_region {
408+
name = "us-east-1"
409+
override_global_data_persistence = "none"
410+
override_global_password = "region-specific-password"
411+
override_global_alert {
412+
name = "dataset-size"
413+
value = 60
414+
}
415+
}
416+
417+
tags = {
418+
"environment" = "production"
419+
"cost_center" = "0700"
420+
}
421+
}
422+
423+
386424
data "rediscloud_active_active_subscription" "example" {
387425
name = rediscloud_active_active_subscription.example.name
388426
}

0 commit comments

Comments
 (0)