@@ -219,18 +219,6 @@ func TestRunReplicateExample(t *testing.T) {
219
219
assert .NotNil (t , output , "Expected some output" )
220
220
}
221
221
222
- func TestRunUpgradeExample (t * testing.T ) {
223
- t .Parallel ()
224
-
225
- options := setupOptions (t , "cos-upgrade" , advancedExampleTerraformDir )
226
-
227
- output , err := options .RunTestUpgrade ()
228
- if ! options .UpgradeTestSkipped {
229
- assert .Nil (t , err , "This should not have errored" )
230
- assert .NotNil (t , output , "Expected some output" )
231
- }
232
- }
233
-
234
222
func getIAMBearerToken (apikey string ) string {
235
223
authEndpoint := "https://iam.cloud.ibm.com/identity/token"
236
224
data := url.Values {}
@@ -327,8 +315,7 @@ func TestRunSolutionsInSchematics(t *testing.T) {
327
315
instanceOptions .TerraformVars = []testschematic.TestSchematicTerraformVar {
328
316
{Name : "ibmcloud_api_key" , Value : instanceOptions .RequiredEnvironmentVars ["TF_VAR_ibmcloud_api_key" ], DataType : "string" , Secure : true },
329
317
{Name : "prefix" , Value : instanceOptions .Prefix , DataType : "string" },
330
- {Name : "resource_group_name" , Value : resourceGroup , DataType : "string" },
331
- {Name : "use_existing_resource_group" , Value : "true" , DataType : "bool" },
318
+ {Name : "existing_resource_group_name" , Value : resourceGroup , DataType : "string" },
332
319
{Name : "existing_secrets_manager_instance_crn" , Value : permanentResources ["secretsManagerCRN" ], DataType : "string" },
333
320
{Name : "service_credential_secrets" , Value : service_credential_secrets , DataType : "list(object{})" },
334
321
}
@@ -361,7 +348,7 @@ func TestRunSolutionsInSchematics(t *testing.T) {
361
348
regionaloptions .TerraformVars = []testschematic.TestSchematicTerraformVar {
362
349
{Name : "ibmcloud_api_key" , Value : regionaloptions .RequiredEnvironmentVars ["TF_VAR_ibmcloud_api_key" ], DataType : "string" , Secure : true },
363
350
{Name : "prefix" , Value : regionaloptions .Prefix , DataType : "string" },
364
- {Name : "bucket_name" , Value : fmt . Sprintf ( "%s- regional-bucket", prefix ) , DataType : "string" },
351
+ {Name : "bucket_name" , Value : " regional-bucket" , DataType : "string" },
365
352
{Name : "region" , Value : region , DataType : "string" },
366
353
{Name : "existing_kms_instance_crn" , Value : permanentResources ["hpcs_south_crn" ], DataType : "string" },
367
354
{Name : "existing_cos_instance_crn" , Value : cos_instance_crn , DataType : "string" },
@@ -390,7 +377,7 @@ func TestRunSolutionsInSchematics(t *testing.T) {
390
377
{Name : "ibmcloud_api_key" , Value : regionaloptions .RequiredEnvironmentVars ["TF_VAR_ibmcloud_api_key" ], DataType : "string" , Secure : true },
391
378
{Name : "prefix" , Value : crossregionaloptions .Prefix , DataType : "string" },
392
379
{Name : "cross_region_location" , Value : "us" , DataType : "string" },
393
- {Name : "bucket_name" , Value : fmt . Sprintf ( "%s- cross-region -bucket", prefix ) , DataType : "string" },
380
+ {Name : "bucket_name" , Value : " cross-regional -bucket" , DataType : "string" },
394
381
{Name : "existing_kms_key_crn" , Value : permanentResources ["hpcs_south_root_key_crn" ], DataType : "string" },
395
382
{Name : "existing_kms_instance_crn" , Value : permanentResources ["hpcs_south_crn" ], DataType : "string" },
396
383
{Name : "existing_cos_instance_crn" , Value : cos_instance_crn , DataType : "string" },
@@ -404,3 +391,127 @@ func TestRunSolutionsInSchematics(t *testing.T) {
404
391
instanceOptions .TestTearDown ()
405
392
406
393
}
394
+
395
+ func TestRunDAUpgradeInSchematics (t * testing.T ) {
396
+ t .Parallel ()
397
+
398
+ prefix := "cos-upg"
399
+
400
+ instanceOptions := testschematic .TestSchematicOptionsDefault (& testschematic.TestSchematicOptions {
401
+ Testing : t ,
402
+ Region : region ,
403
+ Prefix : prefix ,
404
+ TarIncludePatterns : []string {
405
+ "*.tf" ,
406
+ "modules/buckets/*.tf" ,
407
+ "modules/fscloud/*.tf" ,
408
+ solutionInstanceDir + "/*.tf" ,
409
+ },
410
+ TemplateFolder : solutionInstanceDir ,
411
+ Tags : []string {"cos-upg" },
412
+ DeleteWorkspaceOnFail : false ,
413
+ WaitJobCompleteMinutes : 120 ,
414
+ CheckApplyResultForUpgrade : true ,
415
+ })
416
+
417
+ service_credential_secrets := []map [string ]interface {}{
418
+ {
419
+ "secret_group_name" : fmt .Sprintf ("%s-secret-group" , instanceOptions .Prefix ),
420
+ "service_credentials" : []map [string ]string {
421
+ {
422
+ "secret_name" : fmt .Sprintf ("%s-cred-manager" , instanceOptions .Prefix ),
423
+ "service_credentials_source_service_role_crn" : "crn:v1:bluemix:public:iam::::serviceRole:Manager" ,
424
+ },
425
+ {
426
+ "secret_name" : fmt .Sprintf ("%s-cred-writer" , instanceOptions .Prefix ),
427
+ "service_credentials_source_service_role_crn" : "crn:v1:bluemix:public:iam::::serviceRole:Writer" ,
428
+ },
429
+ {
430
+ "secret_name" : fmt .Sprintf ("%s-cred-object-writer" , instanceOptions .Prefix ),
431
+ "service_credentials_source_service_role_crn" : "crn:v1:bluemix:public:cloud-object-storage::::serviceRole:ObjectWriter" ,
432
+ },
433
+ },
434
+ },
435
+ }
436
+
437
+ instanceOptions .TerraformVars = []testschematic.TestSchematicTerraformVar {
438
+ {Name : "ibmcloud_api_key" , Value : instanceOptions .RequiredEnvironmentVars ["TF_VAR_ibmcloud_api_key" ], DataType : "string" , Secure : true },
439
+ {Name : "prefix" , Value : instanceOptions .Prefix , DataType : "string" },
440
+ {Name : "existing_resource_group_name" , Value : resourceGroup , DataType : "string" },
441
+ {Name : "existing_secrets_manager_instance_crn" , Value : permanentResources ["secretsManagerCRN" ], DataType : "string" },
442
+ {Name : "service_credential_secrets" , Value : service_credential_secrets , DataType : "list(object{})" },
443
+ }
444
+
445
+ instanceOptions .SkipTestTearDown = true
446
+ err := instanceOptions .RunSchematicUpgradeTest ()
447
+ assert .Nil (t , err , "This should not have errored" )
448
+
449
+ cos_instance_crn := instanceOptions .LastTestTerraformOutputs ["cos_instance_crn" ].(map [string ]interface {})["value" ].(string )
450
+
451
+ if assert .Nil (t , err , "This should not have errored" ) &&
452
+ assert .NotNil (t , instanceOptions .LastTestTerraformOutputs , "Expected some Terraform outputs" ) {
453
+
454
+ regionaloptions := testschematic .TestSchematicOptionsDefault (& testschematic.TestSchematicOptions {
455
+ Testing : t ,
456
+ Region : region ,
457
+ Prefix : prefix ,
458
+ TarIncludePatterns : []string {
459
+ "*.tf" ,
460
+ "modules/buckets/*.tf" ,
461
+ "modules/fscloud/*.tf" ,
462
+ solutionRegionalDir + "/*.tf" ,
463
+ },
464
+ TemplateFolder : solutionRegionalDir ,
465
+ Tags : []string {"cos-regional-bucket-upgrade-test" },
466
+ DeleteWorkspaceOnFail : false ,
467
+ WaitJobCompleteMinutes : 120 ,
468
+ CheckApplyResultForUpgrade : true ,
469
+ })
470
+
471
+ regionaloptions .TerraformVars = []testschematic.TestSchematicTerraformVar {
472
+ {Name : "ibmcloud_api_key" , Value : regionaloptions .RequiredEnvironmentVars ["TF_VAR_ibmcloud_api_key" ], DataType : "string" , Secure : true },
473
+ {Name : "prefix" , Value : regionaloptions .Prefix , DataType : "string" },
474
+ {Name : "bucket_name" , Value : "regional-bucket" , DataType : "string" },
475
+ {Name : "region" , Value : region , DataType : "string" },
476
+ {Name : "existing_kms_instance_crn" , Value : permanentResources ["hpcs_south_crn" ], DataType : "string" },
477
+ {Name : "existing_cos_instance_crn" , Value : cos_instance_crn , DataType : "string" },
478
+ }
479
+
480
+ regionalerr := regionaloptions .RunSchematicUpgradeTest ()
481
+ assert .Nil (t , regionalerr , "This should not have errored" )
482
+
483
+ crossregionaloptions := testschematic .TestSchematicOptionsDefault (& testschematic.TestSchematicOptions {
484
+ Testing : t ,
485
+ Region : region ,
486
+ Prefix : prefix ,
487
+ TarIncludePatterns : []string {
488
+ "*.tf" ,
489
+ "modules/buckets/*.tf" ,
490
+ "modules/fscloud/*.tf" ,
491
+ solutionCrossRegionDir + "/*.tf" ,
492
+ },
493
+ TemplateFolder : solutionCrossRegionDir ,
494
+ Tags : []string {"cos-cross-regional-bucket-upgrade-test" },
495
+ DeleteWorkspaceOnFail : false ,
496
+ WaitJobCompleteMinutes : 120 ,
497
+ CheckApplyResultForUpgrade : true ,
498
+ })
499
+
500
+ crossregionaloptions .TerraformVars = []testschematic.TestSchematicTerraformVar {
501
+ {Name : "ibmcloud_api_key" , Value : regionaloptions .RequiredEnvironmentVars ["TF_VAR_ibmcloud_api_key" ], DataType : "string" , Secure : true },
502
+ {Name : "prefix" , Value : crossregionaloptions .Prefix , DataType : "string" },
503
+ {Name : "cross_region_location" , Value : "us" , DataType : "string" },
504
+ {Name : "bucket_name" , Value : "cross-regional-bucket" , DataType : "string" },
505
+ {Name : "existing_kms_key_crn" , Value : permanentResources ["hpcs_south_root_key_crn" ], DataType : "string" },
506
+ {Name : "existing_kms_instance_crn" , Value : permanentResources ["hpcs_south_crn" ], DataType : "string" },
507
+ {Name : "existing_cos_instance_crn" , Value : cos_instance_crn , DataType : "string" },
508
+ }
509
+
510
+ crossregionalerr := crossregionaloptions .RunSchematicUpgradeTest ()
511
+ assert .Nil (t , crossregionalerr , "This should not have errored" )
512
+
513
+ }
514
+
515
+ instanceOptions .TestTearDown ()
516
+
517
+ }
0 commit comments