@@ -30,20 +30,23 @@ func TestGoldenGateDeploymentResource_basic(t *testing.T) {
3030 defer httpreplay .SaveScenario ()
3131
3232 const (
33- COMPARTMENT_ID = "compartment_id"
34- COMPARTMENT_ID_FOR_MOVE = "compartment_id_for_move"
35- TEST_SUBNET_ID = "test_subnet_id"
36- LOAD_BALANCER_SUBNET_ID = "load_balancer_subnet_id"
37- CERTIFICATE = "certificate"
38- KEY = "key"
39- BASE_OGG_VERSION = "base_ogg_version"
40- UPGRADED_OGG_VERSION = "upgraded_ogg_version"
41- PASSWORD = "password"
42- NEW_PASSWORD = "new_password"
43- IDENTITY_DOMAIN_ID = "identity_domain_id"
44- PASSWORD_SECRET_ID = "password_secret_id"
45- PASSWORD_SECRET_ID_2 = "password_secret_id_2"
46- GROUP_ID = "group_id"
33+ COMPARTMENT_ID = "compartment_id"
34+ COMPARTMENT_ID_FOR_MOVE = "compartment_id_for_move"
35+ TEST_SUBNET_ID = "test_subnet_id"
36+ LOAD_BALANCER_SUBNET_ID = "load_balancer_subnet_id"
37+ CERTIFICATE = "certificate"
38+ KEY = "key"
39+ BASE_OGG_VERSION = "base_ogg_version"
40+ UPGRADED_OGG_VERSION = "upgraded_ogg_version"
41+ PASSWORD = "password"
42+ NEW_PASSWORD = "new_password"
43+ IDENTITY_DOMAIN_ID = "identity_domain_id"
44+ PASSWORD_SECRET_ID = "password_secret_id"
45+ PASSWORD_SECRET_ID_2 = "password_secret_id_2"
46+ GROUP_ID = "group_id"
47+ OBJECTSTORAGE_BUCKET_NAME = "objectstorage_bucket_name"
48+ OBJECTSTORAGE_NAMESPACE = "objectstorage_namespace"
49+ OBJECTSTORAGE_UPDATE_BUCKET_NAME = "objectstorage_update_bucket_name"
4750 )
4851
4952 var (
@@ -66,15 +69,17 @@ func TestGoldenGateDeploymentResource_basic(t *testing.T) {
6669 "supported_connection_type" : acctest.Representation {RepType : acctest .Required , Create : `GOLDENGATE` },
6770 "filter" : acctest.RepresentationGroup {RepType : acctest .Required , Group : GoldenGateDeploymentDataSourceFilterRepresentation }}
6871
69- compartmentId = utils .GetEnvSettingWithBlankDefault (COMPARTMENT_ID )
70- compartmentIdForMove = utils .GetEnvSettingWithBlankDefault (COMPARTMENT_ID_FOR_MOVE )
71- subnetId = utils .GetEnvSettingWithBlankDefault (TEST_SUBNET_ID )
72- identityDomainId = utils .GetEnvSettingWithBlankDefault (IDENTITY_DOMAIN_ID )
73- passwordSecretId = utils .GetEnvSettingWithBlankDefault (PASSWORD_SECRET_ID )
74- passwordSecretId2 = utils .GetEnvSettingWithBlankDefault (PASSWORD_SECRET_ID_2 )
75- baseOggVersion = utils .GetEnvSettingWithBlankDefault (BASE_OGG_VERSION )
76- upgradedOggVersion = utils .GetEnvSettingWithBlankDefault (UPGRADED_OGG_VERSION )
77- groupId = utils .GetEnvSettingWithBlankDefault (GROUP_ID )
72+ compartmentId = utils .GetEnvSettingWithBlankDefault (COMPARTMENT_ID )
73+ compartmentIdForMove = utils .GetEnvSettingWithBlankDefault (COMPARTMENT_ID_FOR_MOVE )
74+ subnetId = utils .GetEnvSettingWithBlankDefault (TEST_SUBNET_ID )
75+ identityDomainId = utils .GetEnvSettingWithBlankDefault (IDENTITY_DOMAIN_ID )
76+ passwordSecretId = utils .GetEnvSettingWithBlankDefault (PASSWORD_SECRET_ID )
77+ passwordSecretId2 = utils .GetEnvSettingWithBlankDefault (PASSWORD_SECRET_ID_2 )
78+ baseOggVersion = utils .GetEnvSettingWithBlankDefault (BASE_OGG_VERSION )
79+ upgradedOggVersion = utils .GetEnvSettingWithBlankDefault (UPGRADED_OGG_VERSION )
80+ groupId = utils .GetEnvSettingWithBlankDefault (GROUP_ID )
81+ timeBackupScheduledForCreate = time .Now ().UTC ().Add (time .Hour * 3 ).Truncate (time .Millisecond ).Format (time .RFC3339Nano )
82+ timeBackupScheduledForUpdate = time .Now ().UTC ().Add (time .Hour * 6 ).Truncate (time .Millisecond ).Format (time .RFC3339Nano )
7883
7984 resId string
8085 resId2 string
@@ -102,6 +107,15 @@ func TestGoldenGateDeploymentResource_basic(t *testing.T) {
102107 "user_group_id" : acctest.Representation {RepType : acctest .Optional , Update : `${var.group_id}` },
103108 }
104109
110+ deploymentBackupScheduleRepresentation = map [string ]interface {}{
111+ "bucket" : acctest.Representation {RepType : acctest .Required , Create : `${var.objectstorage_bucket_name}` , Update : `${var.objectstorage_update_bucket_name}` },
112+ "compartment_id" : acctest.Representation {RepType : acctest .Required , Create : `${var.compartment_id}` },
113+ "frequency_backup_scheduled" : acctest.Representation {RepType : acctest .Required , Create : `DAILY` , Update : `WEEKLY` },
114+ "is_metadata_only" : acctest.Representation {RepType : acctest .Required , Create : `false` , Update : `true` },
115+ "namespace" : acctest.Representation {RepType : acctest .Required , Create : `${var.objectstorage_namespace}` , Update : `${var.objectstorage_namespace}` },
116+ "time_backup_scheduled" : acctest.Representation {RepType : acctest .Required , Create : timeBackupScheduledForCreate , Update : timeBackupScheduledForUpdate },
117+ }
118+
105119 goldenGateDeploymentOggDataWithGroupRoleMappingRepresentation = map [string ]interface {}{
106120 "admin_password" : acctest.Representation {RepType : acctest .Required , Create : `${var.password}` },
107121 "admin_username" : acctest.Representation {RepType : acctest .Required , Create : `adminUsername` },
@@ -158,6 +172,7 @@ func TestGoldenGateDeploymentResource_basic(t *testing.T) {
158172 "lifecycle" : acctest.RepresentationGroup {RepType : acctest .Required , Group : ignoreDefinedTagsChangesRepresentation },
159173 "maintenance_configuration" : acctest.RepresentationGroup {RepType : acctest .Optional , Group : deploymentMaintenanceConfigurationRepresentation },
160174 "maintenance_window" : acctest.RepresentationGroup {RepType : acctest .Required , Group : deploymentMaintenanceWindowRepresentation },
175+ "backup_schedule" : acctest.RepresentationGroup {RepType : acctest .Optional , Group : deploymentBackupScheduleRepresentation },
161176 }
162177
163178 deploymentLocksRepresentation = map [string ]interface {}{
@@ -199,6 +214,9 @@ func TestGoldenGateDeploymentResource_basic(t *testing.T) {
199214 makeVariableStr (PASSWORD_SECRET_ID , t ) +
200215 makeVariableStr (PASSWORD_SECRET_ID_2 , t ) +
201216 makeVariableStr (GROUP_ID , t ) +
217+ makeVariableStr (OBJECTSTORAGE_BUCKET_NAME , t ) +
218+ makeVariableStr (OBJECTSTORAGE_UPDATE_BUCKET_NAME , t ) +
219+ makeVariableStr (OBJECTSTORAGE_NAMESPACE , t ) +
202220 GoldenGateDeploymentResourceDependencies
203221
204222 if identityDomainId != "" {
@@ -408,6 +426,13 @@ func TestGoldenGateDeploymentResource_basic(t *testing.T) {
408426 Config : config + testDeploymentIdVariableStr +
409427 acctest .GenerateResourceFromRepresentationMap ("oci_golden_gate_deployment" , "depl_test_ggs_deployment" , acctest .Optional , acctest .Create , goldenGateDeploymentRepresentation ),
410428 Check : acctest .ComposeAggregateTestCheckFuncWrapper (
429+ resource .TestCheckResourceAttr (resourceName , "backup_schedule.#" , "1" ),
430+ resource .TestCheckResourceAttrSet (resourceName , "backup_schedule.0.bucket" ),
431+ resource .TestCheckResourceAttr (resourceName , "backup_schedule.0.compartment_id" , compartmentId ),
432+ resource .TestCheckResourceAttr (resourceName , "backup_schedule.0.frequency_backup_scheduled" , "DAILY" ),
433+ resource .TestCheckResourceAttr (resourceName , "backup_schedule.0.is_metadata_only" , "false" ),
434+ resource .TestCheckResourceAttrSet (resourceName , "backup_schedule.0.namespace" ),
435+ resource .TestCheckResourceAttr (resourceName , "backup_schedule.0.time_backup_scheduled" , timeBackupScheduledForCreate ),
411436 resource .TestCheckResourceAttr (resourceName , "compartment_id" , compartmentId ),
412437 resource .TestCheckResourceAttr (resourceName , "cpu_core_count" , "1" ),
413438 resource .TestCheckResourceAttr (resourceName , "deployment_type" , "DATABASE_ORACLE" ),
@@ -456,6 +481,13 @@ func TestGoldenGateDeploymentResource_basic(t *testing.T) {
456481 "compartment_id" : acctest.Representation {RepType : acctest .Required , Create : `${var.compartment_id_for_move}` },
457482 })),
458483 Check : acctest .ComposeAggregateTestCheckFuncWrapper (
484+ resource .TestCheckResourceAttr (resourceName , "backup_schedule.#" , "1" ),
485+ resource .TestCheckResourceAttrSet (resourceName , "backup_schedule.0.bucket" ),
486+ resource .TestCheckResourceAttr (resourceName , "backup_schedule.0.compartment_id" , compartmentId ),
487+ resource .TestCheckResourceAttr (resourceName , "backup_schedule.0.frequency_backup_scheduled" , "DAILY" ),
488+ resource .TestCheckResourceAttr (resourceName , "backup_schedule.0.is_metadata_only" , "false" ),
489+ resource .TestCheckResourceAttrSet (resourceName , "backup_schedule.0.namespace" ),
490+ resource .TestCheckResourceAttr (resourceName , "backup_schedule.0.time_backup_scheduled" , timeBackupScheduledForCreate ),
459491 resource .TestCheckResourceAttr (resourceName , "compartment_id" , compartmentIdForMove ),
460492 resource .TestCheckResourceAttr (resourceName , "cpu_core_count" , "1" ),
461493 resource .TestCheckResourceAttr (resourceName , "deployment_type" , "DATABASE_ORACLE" ),
@@ -497,6 +529,13 @@ func TestGoldenGateDeploymentResource_basic(t *testing.T) {
497529 {
498530 Config : config + testDeploymentIdVariableStr + DeploymentResourceConfig ,
499531 Check : acctest .ComposeAggregateTestCheckFuncWrapper (
532+ resource .TestCheckResourceAttr (resourceName , "backup_schedule.#" , "1" ),
533+ resource .TestCheckResourceAttrSet (resourceName , "backup_schedule.0.bucket" ),
534+ resource .TestCheckResourceAttr (resourceName , "backup_schedule.0.compartment_id" , compartmentId ),
535+ resource .TestCheckResourceAttr (resourceName , "backup_schedule.0.frequency_backup_scheduled" , "WEEKLY" ),
536+ resource .TestCheckResourceAttr (resourceName , "backup_schedule.0.is_metadata_only" , "true" ),
537+ resource .TestCheckResourceAttrSet (resourceName , "backup_schedule.0.namespace" ),
538+ resource .TestCheckResourceAttr (resourceName , "backup_schedule.0.time_backup_scheduled" , timeBackupScheduledForUpdate ),
500539 resource .TestCheckResourceAttr (resourceName , "compartment_id" , compartmentId ),
501540 resource .TestCheckResourceAttr (resourceName , "cpu_core_count" , "1" ),
502541 resource .TestCheckResourceAttr (resourceName , "deployment_type" , "DATABASE_ORACLE" ),
@@ -572,6 +611,13 @@ func TestGoldenGateDeploymentResource_basic(t *testing.T) {
572611 acctest .GenerateDataSourceFromRepresentationMap ("oci_golden_gate_deployment" , "depl_test_ggs_deployment" , acctest .Required , acctest .Create , goldenGateDeploymentSingularDataSourceRepresentation ),
573612 Check : acctest .ComposeAggregateTestCheckFuncWrapper (
574613 resource .TestCheckResourceAttrSet (singularDatasourceName , "deployment_id" ),
614+ resource .TestCheckResourceAttr (singularDatasourceName , "backup_schedule.#" , "1" ),
615+ resource .TestCheckResourceAttrSet (singularDatasourceName , "backup_schedule.0.bucket" ),
616+ resource .TestCheckResourceAttr (singularDatasourceName , "backup_schedule.0.compartment_id" , compartmentId ),
617+ resource .TestCheckResourceAttr (singularDatasourceName , "backup_schedule.0.frequency_backup_scheduled" , "WEEKLY" ),
618+ resource .TestCheckResourceAttr (singularDatasourceName , "backup_schedule.0.is_metadata_only" , "true" ),
619+ resource .TestCheckResourceAttrSet (singularDatasourceName , "backup_schedule.0.namespace" ),
620+ resource .TestCheckResourceAttrSet (singularDatasourceName , "backup_schedule.0.time_backup_scheduled" ),
575621 resource .TestCheckResourceAttr (singularDatasourceName , "compartment_id" , compartmentId ),
576622 resource .TestCheckResourceAttr (singularDatasourceName , "cpu_core_count" , "1" ),
577623 resource .TestCheckResourceAttr (singularDatasourceName , "deployment_type" , "DATABASE_ORACLE" ),
@@ -605,6 +651,7 @@ func TestGoldenGateDeploymentResource_basic(t *testing.T) {
605651 resource .TestCheckResourceAttrSet (singularDatasourceName , "state" ),
606652 resource .TestCheckResourceAttrSet (singularDatasourceName , "storage_utilization_in_bytes" ),
607653 resource .TestCheckResourceAttrSet (singularDatasourceName , "time_created" ),
654+ resource .TestCheckResourceAttrSet (singularDatasourceName , "time_next_backup_scheduled" ),
608655 resource .TestCheckResourceAttrSet (singularDatasourceName , "time_updated" ),
609656 ),
610657 },
0 commit comments