Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions tests/pr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,3 +237,52 @@ func TestRunExistingResourcesInstances(t *testing.T) {
logger.Log(t, "END: Destroy (existing resources)")
}
}

func TestRunSecretsManagerSolutionUpgradeSchematic(t *testing.T) {
t.Parallel()

acme_letsencrypt_private_key := GetSecretsManagerKey( // pragma: allowlist secret
permanentResources["acme_letsencrypt_private_key_sm_id"].(string),
permanentResources["acme_letsencrypt_private_key_sm_region"].(string),
permanentResources["acme_letsencrypt_private_key_secret_id"].(string),
)

// Set up a schematics test
options := testschematic.TestSchematicOptionsDefault(&testschematic.TestSchematicOptions{
Testing: t,
TarIncludePatterns: []string{
"*.tf",
fmt.Sprintf("%s/*.tf", solutionsTerraformDir),
fmt.Sprintf("%s/*.tf", fscloudExampleTerraformDir),
fmt.Sprintf("%s/*.tf", "modules/secrets"),
fmt.Sprintf("%s/*.tf", "modules/fscloud"),
},
TemplateFolder: solutionsTerraformDir,
ResourceGroup: resourceGroup,
Prefix: "sm-da",
Tags: []string{"test-schematic"},
DeleteWorkspaceOnFail: false,
WaitJobCompleteMinutes: 60,
})

options.TerraformVars = []testschematic.TestSchematicTerraformVar{
{Name: "ibmcloud_api_key", Value: options.RequiredEnvironmentVars["TF_VAR_ibmcloud_api_key"], DataType: "string", Secure: true},
{Name: "prefix", Value: options.Prefix, DataType: "string"},
{Name: "region", Value: validRegions[rand.Intn(len(validRegions))], DataType: "string"},
{Name: "resource_group_name", Value: options.Prefix, DataType: "string"},
{Name: "service_plan", Value: "trial", DataType: "string"},
{Name: "existing_kms_instance_crn", Value: permanentResources["hpcs_south_crn"], DataType: "string"},
{Name: "iam_engine_enabled", Value: true, DataType: "bool"},
{Name: "public_engine_enabled", Value: true, DataType: "bool"},
{Name: "private_engine_enabled", Value: true, DataType: "bool"},
{Name: "cis_id", Value: permanentResources["cisInstanceId"], DataType: "string"},
{Name: "ca_name", Value: permanentResources["certificateAuthorityName"], DataType: "string"},
{Name: "dns_provider_name", Value: permanentResources["dnsProviderName"], DataType: "string"},
{Name: "acme_letsencrypt_private_key", Value: *acme_letsencrypt_private_key, DataType: "string"},
}

err := options.RunSchematicUpgradeTest()
if !options.UpgradeTestSkipped {
assert.Nil(t, err, "This should not have errored")
}
}