Skip to content

Commit 73ad3f6

Browse files
authored
test: added addon tests (#124)
1 parent 5dc60d7 commit 73ad3f6

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

tests/pr_test.go

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ import (
1616

1717
"github.com/stretchr/testify/assert"
1818
"github.com/stretchr/testify/require"
19+
"github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/cloudinfo"
1920
"github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/common"
21+
"github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/testaddons"
2022
"github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/testschematic"
2123
)
2224

@@ -277,3 +279,48 @@ func TestUpgradeSecurityEnforced(t *testing.T) {
277279
logger.Log(t, "END: Destroy (prereq resources)")
278280
}
279281
}
282+
283+
func TestAddonDefaultConfiguration(t *testing.T) {
284+
t.Parallel()
285+
286+
options := testaddons.TestAddonsOptionsDefault(&testaddons.TestAddonOptions{
287+
Testing: t,
288+
Prefix: "icl-def",
289+
ResourceGroup: resourceGroup,
290+
QuietMode: true, // Suppress logs except on failure
291+
})
292+
293+
options.AddonConfig = cloudinfo.NewAddonConfigTerraform(
294+
options.Prefix,
295+
"deploy-arch-ibm-cloud-logs",
296+
"fully-configurable",
297+
map[string]interface{}{
298+
"prefix": options.Prefix,
299+
"region": validRegions[rand.Intn(len(validRegions))],
300+
},
301+
)
302+
303+
err := options.RunAddonTest()
304+
require.NoError(t, err)
305+
}
306+
307+
// TestDependencyPermutations runs dependency permutations for Cloud Logs and all its dependencies
308+
func TestDependencyPermutations(t *testing.T) {
309+
t.Skip() // Skipping untill we do a refactor, see https://github.ibm.com/GoldenEye/issues/issues/15593#issuecomment-130654584
310+
311+
options := testaddons.TestAddonsOptionsDefault(&testaddons.TestAddonOptions{
312+
Testing: t,
313+
Prefix: "icl-per",
314+
AddonConfig: cloudinfo.AddonConfig{
315+
OfferingName: "deploy-arch-ibm-cloud-logs",
316+
OfferingFlavor: "fully-configurable",
317+
Inputs: map[string]interface{}{
318+
"prefix": "icl-per",
319+
"region": validRegions[rand.Intn(len(validRegions))],
320+
},
321+
},
322+
})
323+
324+
err := options.RunAddonPermutationTest()
325+
assert.NoError(t, err, "Dependency permutation test should not fail")
326+
}

0 commit comments

Comments
 (0)