@@ -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" ,
@@ -43,7 +43,6 @@ var validRegions = []string{
4343	"ca-tor" ,
4444	"au-syd" ,
4545}
46- 
4746var  permanentResources  map [string ]interface {}
4847
4948func  TestMain (m  * testing.M ) {
@@ -107,9 +106,11 @@ func TestFullyConfigurable(t *testing.T) {
107106			},
108107			ResourceGroup :          resourceGroup ,
109108			TemplateFolder :         fullyConfigurableDADir ,
110- 			Tags :                   []string {"test-schematic" },
109+ 			Tags :                   []string {"test-schematic" ,  "scc-wp-da-fc" },
111110			DeleteWorkspaceOnFail :  false ,
112111			WaitJobCompleteMinutes : 60 ,
112+ 			Region :                 region ,
113+ 			TerraformVersion :       terraformVersion ,
113114			// workaround for https://github.com/terraform-ibm-modules/terraform-ibm-scc-workload-protection/issues/243 
114115			IgnoreAdds : testhelper.Exemptions {
115116				List : []string {"module.scc_wp.restapi_object.cspm" },
@@ -119,7 +120,7 @@ func TestFullyConfigurable(t *testing.T) {
119120		options .TerraformVars  =  []testschematic.TestSchematicTerraformVar {
120121			{Name : "ibmcloud_api_key" , Value : options .RequiredEnvironmentVars ["TF_VAR_ibmcloud_api_key" ], DataType : "string" , Secure : true },
121122			{Name : "existing_resource_group_name" , Value : resourceGroup , DataType : "string" },
122- 			{Name : "region" , Value : region , DataType : "string" },
123+ 			{Name : "region" , Value : options . Region , DataType : "string" },
123124			{Name : "scc_workload_protection_instance_tags" , Value : options .Tags , DataType : "list(string)" },
124125			{Name : "scc_workload_protection_resource_key_tags" , Value : options .Tags , DataType : "list(string)" },
125126			{Name : "scc_workload_protection_access_tags" , Value : permanentResources ["accessTags" ], DataType : "list(string)" },
@@ -192,11 +193,14 @@ func TestFullyConfigurableUpgrade(t *testing.T) {
192193				"*.tf" ,
193194				fullyConfigurableDADir  +  "/*.tf" ,
194195			},
195- 			ResourceGroup :          resourceGroup ,
196- 			TemplateFolder :         fullyConfigurableDADir ,
197- 			Tags :                   []string {"test-schematic" },
198- 			DeleteWorkspaceOnFail :  false ,
199- 			WaitJobCompleteMinutes : 60 ,
196+ 			ResourceGroup :              resourceGroup ,
197+ 			TemplateFolder :             fullyConfigurableDADir ,
198+ 			Tags :                       []string {"test-schematic" },
199+ 			DeleteWorkspaceOnFail :      false ,
200+ 			WaitJobCompleteMinutes :     60 ,
201+ 			CheckApplyResultForUpgrade : true ,
202+ 			Region :                     region ,
203+ 			TerraformVersion :           terraformVersion ,
200204			// workaround for https://github.com/terraform-ibm-modules/terraform-ibm-scc-workload-protection/issues/243 
201205			IgnoreAdds : testhelper.Exemptions {
202206				List : []string {"module.scc_wp.restapi_object.cspm" },
@@ -206,7 +210,7 @@ func TestFullyConfigurableUpgrade(t *testing.T) {
206210		options .TerraformVars  =  []testschematic.TestSchematicTerraformVar {
207211			{Name : "ibmcloud_api_key" , Value : options .RequiredEnvironmentVars ["TF_VAR_ibmcloud_api_key" ], DataType : "string" , Secure : true },
208212			{Name : "existing_resource_group_name" , Value : resourceGroup , DataType : "string" },
209- 			{Name : "region" , Value : region , DataType : "string" },
213+ 			{Name : "region" , Value : options . Region , DataType : "string" },
210214			{Name : "scc_workload_protection_instance_tags" , Value : options .Tags , DataType : "list(string)" },
211215			{Name : "scc_workload_protection_resource_key_tags" , Value : options .Tags , DataType : "list(string)" },
212216			{Name : "scc_workload_protection_access_tags" , Value : permanentResources ["accessTags" ], DataType : "list(string)" },
@@ -233,7 +237,7 @@ func TestFullyConfigurableUpgrade(t *testing.T) {
233237	}
234238}
235239
236- func  TestSccWpAddonDefaultConfiguration (t  * testing.T ) {
240+ func  TestAddonDefaultConfiguration (t  * testing.T ) {
237241	t .Parallel ()
238242
239243	options  :=  testaddons .TestAddonsOptionsDefault (& testaddons.TestAddonOptions {
@@ -256,25 +260,3 @@ func TestSccWpAddonDefaultConfiguration(t *testing.T) {
256260	err  :=  options .RunAddonTest ()
257261	require .NoError (t , err )
258262}
259- 
260- // TestDependencyPermutations runs dependency permutations for SCC WP and all its dependencies 
261- func  TestSccWpDependencyPermutations (t  * testing.T ) {
262- 	// currently Permutation tests is not stable and the test wrapper framework must be updated. Skip tests for now 
263- 	t .Skip ()
264- 	t .Parallel ()
265- 	options  :=  testaddons .TestAddonsOptionsDefault (& testaddons.TestAddonOptions {
266- 		Testing : t ,
267- 		Prefix :  "scc-per" ,
268- 		AddonConfig : cloudinfo.AddonConfig {
269- 			OfferingName :   "deploy-arch-ibm-scc-workload-protection" ,
270- 			OfferingFlavor : "fully-configurable" ,
271- 			Inputs : map [string ]interface {}{
272- 				"prefix" : "scc-per" ,
273- 				"region" : validRegions [rand .Intn (len (validRegions ))],
274- 			},
275- 		},
276- 	})
277- 
278- 	err  :=  options .RunAddonPermutationTest ()
279- 	assert .NoError (t , err , "Dependency permutation test should not fail" )
280- }
0 commit comments