Skip to content

Commit 38e8328

Browse files
Shrey Kapoorsankhsin
authored andcommitted
Bug Fix - BDS Bug Fixes
1 parent f0b184d commit 38e8328

File tree

5 files changed

+132
-156
lines changed

5 files changed

+132
-156
lines changed

internal/integrationtest/bds_odh_instance_resource_test.go

Lines changed: 9 additions & 128 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ var (
5353
"values": acctest.Representation{RepType: acctest.Required, Create: []string{`${oci_bds_bds_instance.test_bds_instance.id}`}},
5454
}
5555

56+
BdsBdsInstanceNetworkConfigRepresentation = map[string]interface{}{
57+
"cidr_block": acctest.Representation{RepType: acctest.Optional, Create: `111.112.0.0/16`},
58+
"is_nat_gateway_required": acctest.Representation{RepType: acctest.Optional, Create: `true`},
59+
}
5660
BdsBdsInstanceNodesRepresentation = map[string]interface{}{
5761
"shape": acctest.Representation{RepType: acctest.Required, Create: `VM.Standard2.1`, Update: `VM.Standard2.4`},
5862
"subnet_id": acctest.Representation{RepType: acctest.Required, Create: `${oci_core_subnet.test_subnet.id}`},
@@ -118,12 +122,6 @@ var (
118122
"compute_only_worker_node": acctest.RepresentationGroup{RepType: acctest.Required, Group: bdsInstanceNodesOdhUtilRepresentation}, // Regular util shape representation usable for compute worker
119123
})
120124

121-
bdsInstanceNodesOdhCloudSqlRepresentation = map[string]interface{}{
122-
"shape": acctest.Representation{RepType: acctest.Required, Create: `VM.Standard2.4`},
123-
"block_volume_size_in_gbs": acctest.Representation{RepType: acctest.Required, Create: `1000`},
124-
// "nvmes": acctest.Representation{RepType: acctest.Optional, Create: `10`}, // Only for VM_DenseIO_E4_Flex. The shape is disabled for now
125-
}
126-
127125
bdsInstanceNodesOdhMasterRepresentation = map[string]interface{}{
128126
"shape": acctest.Representation{RepType: acctest.Required, Create: `VM.Standard2.4`},
129127
"subnet_id": acctest.Representation{RepType: acctest.Required, Create: `${var.subnet_id}`},
@@ -198,17 +196,7 @@ var (
198196
"shape_config": acctest.RepresentationGroup{RepType: acctest.Required, Group: bdsInstanceNodesShapeConfigRepresentation},
199197
}
200198

201-
BdsInstanceOdhResourceDependencies = acctest.GenerateResourceFromRepresentationMap("oci_core_subnet", "test_subnet", acctest.Required, acctest.Create,
202-
acctest.GetMultipleUpdatedRepresenationCopy(
203-
[]string{"cidr_block", "dns_label"},
204-
[]interface{}{acctest.Representation{RepType: acctest.Required, Create: `111.111.0.0/24`}, acctest.Representation{RepType: acctest.Required, Create: `bdssubnet`}},
205-
subnetRegionalRepresentation)) +
206-
acctest.GenerateResourceFromRepresentationMap("oci_core_vcn", "test_vcn", acctest.Required, acctest.Create, acctest.GetMultipleUpdatedRepresenationCopy(
207-
[]string{"cidr_block", "dns_label"},
208-
[]interface{}{acctest.Representation{RepType: acctest.Required, Create: `111.111.0.0/16`}, acctest.Representation{RepType: acctest.Required, Create: `bdsvcn`}},
209-
CoreVcnRepresentation)) +
210-
// DefinedTagsDependencies +
211-
KeyResourceDependencyConfig
199+
BdsInstanceOdhResourceDependencies = KeyResourceDependencyConfig
212200
)
213201

214202
// issue-routing-tag: bds/default
@@ -276,10 +264,12 @@ func TestResourceBdsOdhInstance(t *testing.T) {
276264
},
277265
),
278266
},
267+
279268
// delete before next Create
280269
{
281270
Config: config + compartmentIdVariableStr + BdsInstanceOdhResourceDependencies + bootstrapScriptUrlVariableStr,
282271
},
272+
283273
// verify Create, cluster will be force stopped after create
284274
{
285275
Config: config + compartmentIdVariableStr + kmsKeyIdVariableStr + subnetIdVariableStr + BdsInstanceOdhResourceDependencies + bootstrapScriptUrlVariableStr + bootstrapScriptUrlUVariableStr +
@@ -331,123 +321,12 @@ func TestResourceBdsOdhInstance(t *testing.T) {
331321
resource.TestCheckResourceAttr(resourceName, "state", "ACTIVE"),
332322
),
333323
},
334-
// delete before next Create
335-
{
336-
Config: config + compartmentIdVariableStr + BdsInstanceOdhResourceDependencies + bootstrapScriptUrlVariableStr,
337-
},
338-
// Create cluster with HADOOP_EXTENDED
339-
{
340-
Config: config + compartmentIdVariableStr + kmsKeyIdVariableStr + subnetIdVariableStr + BdsInstanceOdhResourceDependencies + bootstrapScriptUrlVariableStr + bootstrapScriptUrlUVariableStr +
341-
acctest.GenerateResourceFromRepresentationMap("oci_bds_bds_instance", "test_bds_instance", acctest.Optional, acctest.Create,
342-
acctest.RepresentationCopyWithNewProperties(bdsInstanceOdhRepresentation, map[string]interface{}{
343-
"cluster_profile": acctest.Representation{RepType: acctest.Optional, Create: `HADOOP_EXTENDED`},
344-
"display_name": acctest.Representation{RepType: acctest.Required, Create: `hadext1`, Update: `hadext1`},
345-
})),
346-
Check: resource.ComposeAggregateTestCheckFunc(
347-
resource.TestCheckResourceAttr(resourceName, "cluster_admin_password", "T3JhY2xlVGVhbVVTQSExMjM="),
348-
resource.TestCheckResourceAttrSet(resourceName, "cluster_public_key"),
349-
resource.TestCheckResourceAttr(resourceName, "cluster_version", "ODH1"),
350-
resource.TestCheckResourceAttr(resourceName, "compartment_id", compartmentId),
351-
resource.TestCheckResourceAttr(resourceName, "is_high_availability", "true"),
352-
resource.TestCheckResourceAttr(resourceName, "is_secure", "true"),
353-
resource.TestCheckResourceAttrSet(resourceName, "nodes.0.node_type"),
354-
resource.TestCheckResourceAttrSet(resourceName, "nodes.0.shape"),
355-
resource.TestCheckResourceAttrSet(resourceName, "nodes.0.subnet_id"),
356-
resource.TestCheckResourceAttr(resourceName, "state", "ACTIVE"),
357324

358-
func(s *terraform.State) (err error) {
359-
resId, err = acctest.FromInstanceState(s, resourceName, "id")
360-
return err
361-
},
362-
),
363-
},
364-
// Add Kafka to cluster
365-
{
366-
Config: config + compartmentIdVariableStr + compartmentIdUVariableStr + kmsKeyIdVariableStr + subnetIdVariableStr + BdsInstanceOdhResourceDependencies + bootstrapScriptUrlVariableStr + bootstrapScriptUrlUVariableStr + kmsKeyIdUVariableStr +
367-
acctest.GenerateResourceFromRepresentationMap("oci_bds_bds_instance", "test_bds_instance", acctest.Optional, acctest.Update,
368-
acctest.RepresentationCopyWithNewProperties(bdsInstanceOdhRepresentation, map[string]interface{}{
369-
"is_kafka_configured": acctest.Representation{RepType: acctest.Required, Create: `false`, Update: `true`},
370-
"cluster_profile": acctest.Representation{RepType: acctest.Optional, Create: `HADOOP_EXTENDED`, Update: `HADOOP_EXTENDED`},
371-
"display_name": acctest.Representation{RepType: acctest.Required, Create: `hadext1`, Update: `hadext1`},
372-
"kafka_broker_node": acctest.RepresentationGroup{RepType: acctest.Required, Group: bdsInstanceKafkaBrokerNodeFlexShapeRepresentation},
373-
})),
374-
Check: resource.ComposeAggregateTestCheckFunc(
375-
resource.TestCheckResourceAttr(resourceName, "cluster_admin_password", "T3JhY2xlVGVhbVVTQSExMjM="),
376-
resource.TestCheckResourceAttrSet(resourceName, "cluster_public_key"),
377-
resource.TestCheckResourceAttr(resourceName, "cluster_version", "ODH1"),
378-
resource.TestCheckResourceAttr(resourceName, "is_high_availability", "true"),
379-
resource.TestCheckResourceAttr(resourceName, "is_secure", "true"),
380-
resource.TestCheckResourceAttr(resourceName, "is_kafka_configured", "true"),
381-
resource.TestCheckResourceAttrSet(resourceName, "nodes.0.node_type"),
382-
resource.TestCheckResourceAttrSet(resourceName, "nodes.0.shape"),
383-
resource.TestCheckResourceAttrSet(resourceName, "nodes.0.subnet_id"),
384-
resource.TestCheckResourceAttr(resourceName, "state", "ACTIVE"),
385-
),
386-
},
387-
// Remove Kafka to cluster
388-
{
389-
Config: config + compartmentIdVariableStr + compartmentIdUVariableStr + kmsKeyIdVariableStr + subnetIdVariableStr + BdsInstanceOdhResourceDependencies + bootstrapScriptUrlVariableStr + bootstrapScriptUrlUVariableStr + kmsKeyIdUVariableStr +
390-
acctest.GenerateResourceFromRepresentationMap("oci_bds_bds_instance", "test_bds_instance", acctest.Optional, acctest.Update,
391-
acctest.RepresentationCopyWithNewProperties(bdsInstanceOdhRepresentation, map[string]interface{}{
392-
"is_kafka_configured": acctest.Representation{RepType: acctest.Required, Create: `false`, Update: `false`},
393-
"cluster_profile": acctest.Representation{RepType: acctest.Optional, Create: `HADOOP_EXTENDED`, Update: `HADOOP_EXTENDED`},
394-
"display_name": acctest.Representation{RepType: acctest.Required, Create: `hadext1`, Update: `hadext1`},
395-
})),
396-
Check: resource.ComposeAggregateTestCheckFunc(
397-
resource.TestCheckResourceAttr(resourceName, "cluster_admin_password", "T3JhY2xlVGVhbVVTQSExMjM="),
398-
resource.TestCheckResourceAttrSet(resourceName, "cluster_public_key"),
399-
resource.TestCheckResourceAttr(resourceName, "cluster_version", "ODH1"),
400-
resource.TestCheckResourceAttr(resourceName, "is_high_availability", "true"),
401-
resource.TestCheckResourceAttr(resourceName, "is_secure", "true"),
402-
resource.TestCheckResourceAttr(resourceName, "is_kafka_configured", "false"),
403-
resource.TestCheckResourceAttrSet(resourceName, "nodes.0.node_type"),
404-
resource.TestCheckResourceAttrSet(resourceName, "nodes.0.shape"),
405-
resource.TestCheckResourceAttrSet(resourceName, "nodes.0.subnet_id"),
406-
resource.TestCheckResourceAttr(resourceName, "state", "ACTIVE"),
407-
),
408-
},
409325
// delete before next Create
410326
{
411327
Config: config + compartmentIdVariableStr + BdsInstanceOdhResourceDependencies + bootstrapScriptUrlVariableStr,
412328
},
413-
// verify Create with required fields Kafka cluster
414-
{
415-
Config: config + compartmentIdVariableStr + kmsKeyIdVariableStr + subnetIdVariableStr + BdsInstanceOdhResourceDependencies + bootstrapScriptUrlVariableStr +
416-
acctest.GenerateResourceFromRepresentationMap("oci_bds_bds_instance", "test_bds_instance", acctest.Required, acctest.Create,
417-
acctest.RepresentationCopyWithNewProperties(bdsInstanceOdhRepresentation, map[string]interface{}{
418-
"is_kafka_configured": acctest.Representation{RepType: acctest.Required, Create: `false`, Update: `false`},
419-
"cluster_profile": acctest.Representation{RepType: acctest.Optional, Create: `KAFKA`, Update: `HADOOP_EXTENDED`},
420-
"display_name": acctest.Representation{RepType: acctest.Required, Create: `kafkacluster`, Update: `kafkacluster`},
421-
"kafka_broker_node": acctest.RepresentationGroup{RepType: acctest.Required, Group: bdsInstanceKafkaBrokerNodeFlexShapeRepresentation},
422-
})),
423-
Check: resource.ComposeAggregateTestCheckFunc(
424-
resource.TestCheckResourceAttr(resourceName, "cluster_admin_password", "T3JhY2xlVGVhbVVTQSExMjM="),
425-
resource.TestCheckResourceAttrSet(resourceName, "cluster_public_key"),
426-
resource.TestCheckResourceAttr(resourceName, "cluster_version", "ODH1"),
427-
resource.TestCheckResourceAttr(resourceName, "compartment_id", compartmentId),
428-
resource.TestCheckResourceAttr(resourceName, "is_high_availability", "true"),
429-
resource.TestCheckResourceAttr(resourceName, "is_secure", "true"),
430-
resource.TestCheckResourceAttr(resourceName, "is_kafka_configured", "false"),
431-
resource.TestCheckResourceAttrSet(resourceName, "nodes.0.node_type"),
432-
resource.TestCheckResourceAttrSet(resourceName, "nodes.0.shape"),
433-
resource.TestCheckResourceAttrSet(resourceName, "nodes.0.subnet_id"),
434-
435-
func(s *terraform.State) (err error) {
436-
resId, err = acctest.FromInstanceState(s, resourceName, "id")
437-
if isEnableExportCompartment, _ := strconv.ParseBool(utils.GetEnvSettingWithDefault("enable_export_compartment", "true")); isEnableExportCompartment {
438-
if errExport := resourcediscovery.TestExportCompartmentWithResourceName(&resId, &compartmentId, resourceName); errExport != nil {
439-
return errExport
440-
}
441-
}
442-
return err
443-
},
444-
),
445-
},
446329

447-
// delete before next Create
448-
{
449-
Config: config + compartmentIdVariableStr + BdsInstanceOdhResourceDependencies + bootstrapScriptUrlVariableStr,
450-
},
451330
// verify Create with optionals
452331
{
453332
Config: config + compartmentIdVariableStr + kmsKeyIdVariableStr + subnetIdVariableStr + BdsInstanceOdhResourceDependencies + bootstrapScriptUrlVariableStr +
@@ -500,6 +379,7 @@ func TestResourceBdsOdhInstance(t *testing.T) {
500379
},
501380
),
502381
},
382+
503383
// verify Update to the compartment (the compartment will be switched back in the next step) and change shapes
504384
{
505385
Config: config + compartmentIdVariableStr + compartmentIdUVariableStr + kmsKeyIdVariableStr + subnetIdVariableStr + bootstrapScriptUrlVariableStr + BdsInstanceOdhResourceDependencies +
@@ -553,6 +433,7 @@ func TestResourceBdsOdhInstance(t *testing.T) {
553433
},
554434
),
555435
},
436+
556437
// verify updates to updatable parameters, add a worker, update compute worker flex->regular, update util regular -> flex
557438
{
558439
Config: config + compartmentIdVariableStr + kmsKeyIdUVariableStr + bootstrapScriptUrlVariableStr + bootstrapScriptUrlUVariableStr + subnetIdVariableStr + BdsInstanceOdhResourceDependencies +

0 commit comments

Comments
 (0)