diff --git a/tests/go.mod b/tests/go.mod index 1d6e071..80453dd 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -7,7 +7,7 @@ toolchain go1.25.0 require ( github.com/gruntwork-io/terratest v0.50.0 github.com/stretchr/testify v1.10.0 - github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.59.1 + github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.59.7 ) require ( diff --git a/tests/go.sum b/tests/go.sum index 538a020..c58a8a7 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -295,8 +295,8 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.59.1 h1:9/uYvUFFLIH91F16AiJqP/LZeGi4t2CYtc8iz3bBXdQ= -github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.59.1/go.mod h1:kdhZ+FeS71D+tB0E2Sh1ISD3zQ+RThPX5SyFqduo7G8= +github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.59.7 h1:HyrZbLB+7dv9Fspe2wvnCe1IYMC6K6AQcoaktQf30j0= +github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.59.7/go.mod h1:kdhZ+FeS71D+tB0E2Sh1ISD3zQ+RThPX5SyFqduo7G8= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tmccombs/hcl2json v0.6.4 h1:/FWnzS9JCuyZ4MNwrG4vMrFrzRgsWEOVi+1AyYUVLGw= github.com/tmccombs/hcl2json v0.6.4/go.mod h1:+ppKlIW3H5nsAsZddXPy2iMyvld3SHxyjswOZhavRDk= diff --git a/tests/pr_test.go b/tests/pr_test.go index de18e04..1bf7292 100644 --- a/tests/pr_test.go +++ b/tests/pr_test.go @@ -14,7 +14,9 @@ import ( "github.com/gruntwork-io/terratest/modules/terraform" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/cloudinfo" "github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/common" + "github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/testaddons" "github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/testhelper" "github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/testschematic" ) @@ -219,3 +221,48 @@ func TestRunAccountSettings(t *testing.T) { err := options.RunSchematicTest() assert.Nil(t, err, "This should not have errored") } + +func TestAddonDefaultConfiguration(t *testing.T) { + t.Parallel() + + options := testaddons.TestAddonsOptionsDefault(&testaddons.TestAddonOptions{ + Testing: t, + Prefix: "icm-def", + ResourceGroup: resourceGroup, + QuietMode: true, // Suppress logs except on failure + }) + + options.AddonConfig = cloudinfo.NewAddonConfigTerraform( + options.Prefix, + "deploy-arch-ibm-cloud-monitoring", + "fully-configurable", + map[string]interface{}{ + "prefix": options.Prefix, + "region": validRegions[rand.Intn(len(validRegions))], + }, + ) + + err := options.RunAddonTest() + require.NoError(t, err) +} + +// TestDependencyPermutations runs dependency permutations for Cloud Monitoring and all its dependencies +func TestDependencyPermutations(t *testing.T) { + t.Parallel() + + options := testaddons.TestAddonsOptionsDefault(&testaddons.TestAddonOptions{ + Testing: t, + Prefix: "icm-per", + AddonConfig: cloudinfo.AddonConfig{ + OfferingName: "deploy-arch-ibm-cloud-monitoring", + OfferingFlavor: "fully-configurable", + Inputs: map[string]interface{}{ + "prefix": "icm-per", + "region": validRegions[rand.Intn(len(validRegions))], + }, + }, + }) + + err := options.RunAddonPermutationTest() + assert.NoError(t, err, "Dependency permutation test should not fail") +}