@@ -22,15 +22,15 @@ import (
2222 "github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/testschematic"
2323)
2424
25+ /*
26+ Global variables
27+ */
2528const resourceGroup = "geretain-test-resources"
2629const fullyConfigurableDADir = "solutions/fully-configurable"
27-
28- var existingResources = "./existing-resources"
29-
30- // Define a struct with fields that match the structure of the YAML data.
3130const yamlLocation = "../common-dev-assets/common-go-assets/common-permanent-resources.yaml"
31+ const existingResources = "./existing-resources"
32+ const terraformVersion = "terraform_v1.10" // This should match the version in the ibm_catalog.json
3233
33- // Current supported SCC Workload Protection region
3434var validRegions = []string {
3535 "us-south" ,
3636 "us-east" ,
@@ -44,7 +44,6 @@ var validRegions = []string{
4444 "ca-tor" ,
4545 "au-syd" ,
4646}
47-
4847var permanentResources map [string ]interface {}
4948
5049func TestMain (m * testing.M ) {
@@ -108,9 +107,11 @@ func TestFullyConfigurable(t *testing.T) {
108107 },
109108 ResourceGroup : resourceGroup ,
110109 TemplateFolder : fullyConfigurableDADir ,
111- Tags : []string {"test-schematic" },
110+ Tags : []string {"test-schematic" , "scc-wp-da-fc" },
112111 DeleteWorkspaceOnFail : false ,
113112 WaitJobCompleteMinutes : 60 ,
113+ Region : region ,
114+ TerraformVersion : terraformVersion ,
114115 // workaround for https://github.com/terraform-ibm-modules/terraform-ibm-scc-workload-protection/issues/243
115116 IgnoreAdds : testhelper.Exemptions {
116117 List : []string {"module.scc_wp.restapi_object.cspm" },
@@ -120,7 +121,7 @@ func TestFullyConfigurable(t *testing.T) {
120121 options .TerraformVars = []testschematic.TestSchematicTerraformVar {
121122 {Name : "ibmcloud_api_key" , Value : options .RequiredEnvironmentVars ["TF_VAR_ibmcloud_api_key" ], DataType : "string" , Secure : true },
122123 {Name : "existing_resource_group_name" , Value : resourceGroup , DataType : "string" },
123- {Name : "region" , Value : region , DataType : "string" },
124+ {Name : "region" , Value : options . Region , DataType : "string" },
124125 {Name : "scc_workload_protection_instance_tags" , Value : options .Tags , DataType : "list(string)" },
125126 {Name : "scc_workload_protection_resource_key_tags" , Value : options .Tags , DataType : "list(string)" },
126127 {Name : "scc_workload_protection_access_tags" , Value : permanentResources ["accessTags" ], DataType : "list(string)" },
@@ -193,11 +194,14 @@ func TestFullyConfigurableUpgrade(t *testing.T) {
193194 "*.tf" ,
194195 fullyConfigurableDADir + "/*.tf" ,
195196 },
196- ResourceGroup : resourceGroup ,
197- TemplateFolder : fullyConfigurableDADir ,
198- Tags : []string {"test-schematic" },
199- DeleteWorkspaceOnFail : false ,
200- WaitJobCompleteMinutes : 60 ,
197+ ResourceGroup : resourceGroup ,
198+ TemplateFolder : fullyConfigurableDADir ,
199+ Tags : []string {"test-schematic" },
200+ DeleteWorkspaceOnFail : false ,
201+ WaitJobCompleteMinutes : 60 ,
202+ CheckApplyResultForUpgrade : true ,
203+ Region : region ,
204+ TerraformVersion : terraformVersion ,
201205 // workaround for https://github.com/terraform-ibm-modules/terraform-ibm-scc-workload-protection/issues/243
202206 IgnoreAdds : testhelper.Exemptions {
203207 List : []string {"module.scc_wp.restapi_object.cspm" },
@@ -207,7 +211,7 @@ func TestFullyConfigurableUpgrade(t *testing.T) {
207211 options .TerraformVars = []testschematic.TestSchematicTerraformVar {
208212 {Name : "ibmcloud_api_key" , Value : options .RequiredEnvironmentVars ["TF_VAR_ibmcloud_api_key" ], DataType : "string" , Secure : true },
209213 {Name : "existing_resource_group_name" , Value : resourceGroup , DataType : "string" },
210- {Name : "region" , Value : region , DataType : "string" },
214+ {Name : "region" , Value : options . Region , DataType : "string" },
211215 {Name : "scc_workload_protection_instance_tags" , Value : options .Tags , DataType : "list(string)" },
212216 {Name : "scc_workload_protection_resource_key_tags" , Value : options .Tags , DataType : "list(string)" },
213217 {Name : "scc_workload_protection_access_tags" , Value : permanentResources ["accessTags" ], DataType : "list(string)" },
@@ -234,7 +238,7 @@ func TestFullyConfigurableUpgrade(t *testing.T) {
234238 }
235239}
236240
237- func TestSccWpAddonDefaultConfiguration (t * testing.T ) {
241+ func TestAddonDefaultConfiguration (t * testing.T ) {
238242 t .Parallel ()
239243
240244 options := testaddons .TestAddonsOptionsDefault (& testaddons.TestAddonOptions {
@@ -257,25 +261,3 @@ func TestSccWpAddonDefaultConfiguration(t *testing.T) {
257261 err := options .RunAddonTest ()
258262 require .NoError (t , err )
259263}
260-
261- // TestDependencyPermutations runs dependency permutations for SCC WP and all its dependencies
262- func TestSccWpDependencyPermutations (t * testing.T ) {
263- // currently Permutation tests is not stable and the test wrapper framework must be updated. Skip tests for now
264- t .Skip ()
265- t .Parallel ()
266- options := testaddons .TestAddonsOptionsDefault (& testaddons.TestAddonOptions {
267- Testing : t ,
268- Prefix : "scc-per" ,
269- AddonConfig : cloudinfo.AddonConfig {
270- OfferingName : "deploy-arch-ibm-scc-workload-protection" ,
271- OfferingFlavor : "fully-configurable" ,
272- Inputs : map [string ]interface {}{
273- "prefix" : "scc-per" ,
274- "region" : validRegions [rand .Intn (len (validRegions ))],
275- },
276- },
277- })
278-
279- err := options .RunAddonPermutationTest ()
280- assert .NoError (t , err , "Dependency permutation test should not fail" )
281- }
0 commit comments