@@ -70,18 +70,6 @@ func setupOptions(t *testing.T, prefix string, checkApplyResultForUpgrade bool)
7070 return options
7171}
7272
73- func TestRunUpgradeExample (t * testing.T ) {
74- t .Parallel ()
75-
76- options := setupOptions (t , "secrets-mgr-upg" , true )
77-
78- output , err := options .RunTestUpgrade ()
79- if ! options .UpgradeTestSkipped {
80- assert .Nil (t , err , "This should not have errored" )
81- assert .NotNil (t , output , "Expected some output" )
82- }
83- }
84-
8573func TestRunDASolutionSchematics (t * testing.T ) {
8674 t .Parallel ()
8775
@@ -237,3 +225,52 @@ func TestRunExistingResourcesInstances(t *testing.T) {
237225 logger .Log (t , "END: Destroy (existing resources)" )
238226 }
239227}
228+
229+ func TestRunSecretsManagerSolutionUpgradeSchematic (t * testing.T ) {
230+ t .Parallel ()
231+
232+ acme_letsencrypt_private_key := GetSecretsManagerKey ( // pragma: allowlist secret
233+ permanentResources ["acme_letsencrypt_private_key_sm_id" ].(string ),
234+ permanentResources ["acme_letsencrypt_private_key_sm_region" ].(string ),
235+ permanentResources ["acme_letsencrypt_private_key_secret_id" ].(string ),
236+ )
237+
238+ // Set up a schematics test
239+ options := testschematic .TestSchematicOptionsDefault (& testschematic.TestSchematicOptions {
240+ Testing : t ,
241+ TarIncludePatterns : []string {
242+ "*.tf" ,
243+ fmt .Sprintf ("%s/*.tf" , solutionsTerraformDir ),
244+ fmt .Sprintf ("%s/*.tf" , fscloudExampleTerraformDir ),
245+ fmt .Sprintf ("%s/*.tf" , "modules/secrets" ),
246+ fmt .Sprintf ("%s/*.tf" , "modules/fscloud" ),
247+ },
248+ TemplateFolder : solutionsTerraformDir ,
249+ ResourceGroup : resourceGroup ,
250+ Prefix : "sm-da" ,
251+ Tags : []string {"test-schematic" },
252+ DeleteWorkspaceOnFail : false ,
253+ WaitJobCompleteMinutes : 60 ,
254+ })
255+
256+ options .TerraformVars = []testschematic.TestSchematicTerraformVar {
257+ {Name : "ibmcloud_api_key" , Value : options .RequiredEnvironmentVars ["TF_VAR_ibmcloud_api_key" ], DataType : "string" , Secure : true },
258+ {Name : "prefix" , Value : options .Prefix , DataType : "string" },
259+ {Name : "region" , Value : validRegions [rand .Intn (len (validRegions ))], DataType : "string" },
260+ {Name : "resource_group_name" , Value : options .Prefix , DataType : "string" },
261+ {Name : "service_plan" , Value : "trial" , DataType : "string" },
262+ {Name : "existing_kms_instance_crn" , Value : permanentResources ["hpcs_south_crn" ], DataType : "string" },
263+ {Name : "iam_engine_enabled" , Value : true , DataType : "bool" },
264+ {Name : "public_engine_enabled" , Value : true , DataType : "bool" },
265+ {Name : "private_engine_enabled" , Value : true , DataType : "bool" },
266+ {Name : "cis_id" , Value : permanentResources ["cisInstanceId" ], DataType : "string" },
267+ {Name : "ca_name" , Value : permanentResources ["certificateAuthorityName" ], DataType : "string" },
268+ {Name : "dns_provider_name" , Value : permanentResources ["dnsProviderName" ], DataType : "string" },
269+ {Name : "acme_letsencrypt_private_key" , Value : * acme_letsencrypt_private_key , DataType : "string" },
270+ }
271+
272+ err := options .RunSchematicUpgradeTest ()
273+ if ! options .UpgradeTestSkipped {
274+ assert .Nil (t , err , "This should not have errored" )
275+ }
276+ }
0 commit comments