Skip to content

Commit bcc4a0f

Browse files
Darahaas YajamanyamMaxrovr
authored andcommitted
Added - MySQL database support for FSDR
1 parent 0e8f96f commit bcc4a0f

8 files changed

+799
-173
lines changed

internal/integrationtest/disaster_recovery_dr_plan_execution_test.go

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ import (
2626

2727
var (
2828
DisasterRecoveryDrPlanExecutionRequiredOnlyResource = DisasterRecoveryDrPlanExecutionResourceDependencies +
29+
DrProtectionGroupWithMySQLConfig + DrPlanConfig +
2930
acctest.GenerateResourceFromRepresentationMap("oci_disaster_recovery_dr_plan_execution", "test_dr_plan_execution", acctest.Required, acctest.Create, DisasterRecoveryDrPlanExecutionRepresentation)
3031

3132
DisasterRecoveryDrPlanExecutionResourceConfig = DisasterRecoveryDrPlanExecutionResourceDependencies +
33+
DrProtectionGroupWithMySQLConfig + DrPlanConfig +
3234
acctest.GenerateResourceFromRepresentationMap("oci_disaster_recovery_dr_plan_execution", "test_dr_plan_execution", acctest.Optional, acctest.Update, DisasterRecoveryDrPlanExecutionRepresentation)
3335

3436
DisasterRecoveryDisasterRecoveryDrPlanExecutionSingularDataSourceRepresentation = map[string]interface{}{
@@ -61,15 +63,18 @@ var (
6163
"are_warnings_ignored": acctest.Representation{RepType: acctest.Optional, Create: `false`},
6264
}
6365

64-
DisasterRecoveryDrPlanExecutionResourceDependencies = acctest.GenerateResourceFromRepresentationMap("oci_disaster_recovery_dr_protection_group", "test_peer", acctest.Optional, acctest.Create, DisasterRecoveryPeerDrProtectionGroupRepresentation) +
66+
DisasterRecoveryDrPlanExecutionResourceDependencies = acctest.GenerateResourceFromRepresentationMap("oci_disaster_recovery_dr_protection_group", "test_peer", acctest.Required, acctest.Create, DisasterRecoveryPeerDrProtectionGroupWithStandbyMySQLRepresentation) +
6567
ObjectStorageBucketDependencyConfig +
6668
VolumeGroupDependencyConfig +
69+
ComputeInstanceDependencyConfig +
70+
FileSystemDependencyConfig +
71+
MySQLDatabaseDependencyConfig +
6772
AvailabilityDomainConfig
6873
//DefinedTagsDependencies
6974

70-
DrProtectionGroupConfig = acctest.GenerateResourceFromRepresentationMap("oci_disaster_recovery_dr_protection_group", "test_dr_protection_group", acctest.Optional, acctest.Create, DisasterRecoveryDrProtectionGroupRepresentation)
75+
DrProtectionGroupWithMySQLConfig = acctest.GenerateResourceFromRepresentationMap("oci_disaster_recovery_dr_protection_group", "test_dr_protection_group", acctest.Optional, acctest.Create, DisasterRecoveryDrProtectionGroupWithPrimaryMySQLRepresentation)
7176

72-
DrProtectionGroupWithDisassociateTriggerConfig = acctest.GenerateResourceFromRepresentationMap("oci_disaster_recovery_dr_protection_group", "test_dr_protection_group", acctest.Optional, acctest.Update, acctest.RepresentationCopyWithNewProperties(DisasterRecoveryDrProtectionGroupRepresentation, map[string]interface{}{
77+
DrProtectionGroupWithDisassociateTriggerConfig = acctest.GenerateResourceFromRepresentationMap("oci_disaster_recovery_dr_protection_group", "test_dr_protection_group", acctest.Optional, acctest.Update, acctest.RepresentationCopyWithNewProperties(DisasterRecoveryDrProtectionGroupWithPrimaryMySQLRepresentation, map[string]interface{}{
7378
"disassociate_trigger": acctest.Representation{RepType: acctest.Optional, Create: `0`, Update: `1`},
7479
}))
7580

@@ -93,19 +98,23 @@ func TestDisasterRecoveryDrPlanExecutionResource_basic(t *testing.T) {
9398
var resId, resId2 string
9499
// Save TF content to Create resource with optional properties. This has to be exactly the same as the config part in the "create with optionals" step in the test.
95100
acctest.SaveConfigContent(config+compartmentIdVariableStr+DisasterRecoveryDrPlanExecutionResourceDependencies+
96-
DrProtectionGroupConfig+DrPlanConfig+
101+
DrProtectionGroupWithMySQLConfig+DrPlanConfig+
97102
acctest.GenerateResourceFromRepresentationMap("oci_disaster_recovery_dr_plan_execution", "test_dr_plan_execution", acctest.Optional, acctest.Create, DisasterRecoveryDrPlanExecutionRepresentation), "disasterrecovery", "drPlanExecution", t)
98103

99104
acctest.ResourceTest(t, nil, []resource.TestStep{
100105
// Create Dependencies
106+
{
107+
Config: config + compartmentIdVariableStr + DisasterRecoveryDrPlanExecutionResourceDependencies,
108+
},
109+
// Create primary DRPG and establish association
101110
{
102111
Config: config + compartmentIdVariableStr + DisasterRecoveryDrPlanExecutionResourceDependencies +
103-
DrProtectionGroupConfig,
112+
DrProtectionGroupWithMySQLConfig,
104113
},
105-
// verify Create
114+
// verify Create DR Plan and execution
106115
{
107116
Config: config + compartmentIdVariableStr + DisasterRecoveryDrPlanExecutionResourceDependencies +
108-
DrProtectionGroupConfig + DrPlanConfig +
117+
DrProtectionGroupWithMySQLConfig + DrPlanConfig +
109118
acctest.GenerateResourceFromRepresentationMap("oci_disaster_recovery_dr_plan_execution", "test_dr_plan_execution", acctest.Required, acctest.Create, DisasterRecoveryDrPlanExecutionRepresentation),
110119
Check: acctest.ComposeAggregateTestCheckFuncWrapper(
111120
resource.TestCheckResourceAttr(resourceName, "execution_options.#", "1"),
@@ -122,12 +131,12 @@ func TestDisasterRecoveryDrPlanExecutionResource_basic(t *testing.T) {
122131
// delete before next Create
123132
{
124133
Config: config + compartmentIdVariableStr + DisasterRecoveryDrPlanExecutionResourceDependencies +
125-
DrProtectionGroupConfig + DrPlanConfig,
134+
DrProtectionGroupWithMySQLConfig + DrPlanConfig,
126135
},
127136
// verify Create with optionals
128137
{
129138
Config: config + compartmentIdVariableStr + DisasterRecoveryDrPlanExecutionResourceDependencies +
130-
DrProtectionGroupConfig + DrPlanConfig +
139+
DrProtectionGroupWithMySQLConfig + DrPlanConfig +
131140
acctest.GenerateResourceFromRepresentationMap("oci_disaster_recovery_dr_plan_execution", "test_dr_plan_execution", acctest.Optional, acctest.Create, DisasterRecoveryDrPlanExecutionRepresentation),
132141
Check: acctest.ComposeAggregateTestCheckFuncWrapper(
133142
resource.TestCheckResourceAttrSet(resourceName, "compartment_id"),
@@ -164,7 +173,7 @@ func TestDisasterRecoveryDrPlanExecutionResource_basic(t *testing.T) {
164173
// verify updates to updatable parameters
165174
{
166175
Config: config + compartmentIdVariableStr + DisasterRecoveryDrPlanExecutionResourceDependencies +
167-
DrProtectionGroupConfig + DrPlanConfig +
176+
DrProtectionGroupWithMySQLConfig + DrPlanConfig +
168177
acctest.GenerateResourceFromRepresentationMap("oci_disaster_recovery_dr_plan_execution", "test_dr_plan_execution", acctest.Optional, acctest.Update, DisasterRecoveryDrPlanExecutionRepresentation),
169178
Check: acctest.ComposeAggregateTestCheckFuncWrapper(
170179
resource.TestCheckResourceAttrSet(resourceName, "compartment_id"),
@@ -198,7 +207,7 @@ func TestDisasterRecoveryDrPlanExecutionResource_basic(t *testing.T) {
198207
// verify datasource
199208
{
200209
Config: config + compartmentIdVariableStr + DisasterRecoveryDrPlanExecutionResourceDependencies +
201-
DrProtectionGroupConfig + DrPlanConfig +
210+
DrProtectionGroupWithMySQLConfig + DrPlanConfig +
202211
acctest.GenerateDataSourceFromRepresentationMap("oci_disaster_recovery_dr_plan_executions", "test_dr_plan_executions", acctest.Optional, acctest.Update,
203212
acctest.RepresentationCopyWithRemovedProperties(DisasterRecoveryDisasterRecoveryDrPlanExecutionDataSourceRepresentation, []string{"state"})) +
204213
acctest.GenerateResourceFromRepresentationMap("oci_disaster_recovery_dr_plan_execution", "test_dr_plan_execution", acctest.Optional, acctest.Update, DisasterRecoveryDrPlanExecutionRepresentation),
@@ -215,7 +224,6 @@ func TestDisasterRecoveryDrPlanExecutionResource_basic(t *testing.T) {
215224
// verify singular datasource
216225
{
217226
Config: config + compartmentIdVariableStr + DisasterRecoveryDrPlanExecutionResourceConfig +
218-
DrProtectionGroupConfig + DrPlanConfig +
219227
acctest.GenerateDataSourceFromRepresentationMap("oci_disaster_recovery_dr_plan_execution", "test_dr_plan_execution", acctest.Required, acctest.Create, DisasterRecoveryDisasterRecoveryDrPlanExecutionSingularDataSourceRepresentation),
220228
Check: acctest.ComposeAggregateTestCheckFuncWrapper(
221229
resource.TestCheckResourceAttrSet(singularDatasourceName, "dr_plan_execution_id"),
@@ -244,8 +252,7 @@ func TestDisasterRecoveryDrPlanExecutionResource_basic(t *testing.T) {
244252
},
245253
// verify resource import
246254
{
247-
Config: config + compartmentIdVariableStr + DisasterRecoveryDrPlanExecutionRequiredOnlyResource +
248-
DrProtectionGroupConfig + DrPlanConfig,
255+
Config: config + compartmentIdVariableStr + DisasterRecoveryDrPlanExecutionRequiredOnlyResource,
249256
ImportState: true,
250257
ImportStateVerify: true,
251258
ImportStateVerifyIgnore: []string{},
@@ -254,7 +261,7 @@ func TestDisasterRecoveryDrPlanExecutionResource_basic(t *testing.T) {
254261
// delete dr plan and dr plan execution
255262
{
256263
Config: config + compartmentIdVariableStr + DisasterRecoveryDrPlanExecutionResourceDependencies +
257-
DrProtectionGroupConfig,
264+
DrProtectionGroupWithMySQLConfig,
258265
},
259266
// Disassociate DrProtectionGroup
260267
{

0 commit comments

Comments
 (0)