-
Notifications
You must be signed in to change notification settings - Fork 3
fix: add new Addon tests #496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
30a3ebb
29c66aa
fdcf753
d39a4ed
11998da
18499fe
aafb305
2b85b6c
ecaa6dd
8e3ec2c
bc43566
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,14 +10,17 @@ import ( | |
| "strings" | ||
| "testing" | ||
|
|
||
| "github.com/IBM/go-sdk-core/v5/core" | ||
| "github.com/gruntwork-io/terratest/modules/files" | ||
| "github.com/gruntwork-io/terratest/modules/logger" | ||
| "github.com/gruntwork-io/terratest/modules/random" | ||
| "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" | ||
| ) | ||
|
|
@@ -482,3 +485,290 @@ func TestRunExistingResourcesInstances(t *testing.T) { | |
| logger.Log(t, "END: Destroy (existing resources)") | ||
| } | ||
| } | ||
|
|
||
| // TestRunFullyConfigurableAddonTests runs addon tests for the fully-configurable flavor using matrix approach | ||
daniel-butler-irl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| func TestRunFullyConfigurableAddonTests(t *testing.T) { | ||
| testCases := []testaddons.AddonTestCase{ | ||
| { | ||
| Name: "EN-Default-Configuration", | ||
| Prefix: "endeft", | ||
| }, | ||
| { | ||
| Name: "EN-With-Resource-Group-Only", | ||
| Prefix: "enrgol", | ||
| Dependencies: []cloudinfo.AddonConfig{ | ||
| { | ||
| OfferingName: "deploy-arch-ibm-account-infra-base", | ||
| OfferingFlavor: "resource-group-only", | ||
| Enabled: core.BoolPtr(true), | ||
daniel-butler-irl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| }, | ||
| SkipInfrastructureDeployment: true, | ||
| }, | ||
| { | ||
| Name: "EN-With-Resource-Group-And-Account-Settings", | ||
| Prefix: "enrgas", | ||
| Dependencies: []cloudinfo.AddonConfig{ | ||
| { | ||
| OfferingName: "deploy-arch-ibm-account-infra-base", | ||
| OfferingFlavor: "resource-groups-with-account-settings", | ||
| Enabled: core.BoolPtr(true), | ||
| }, | ||
| }, | ||
| SkipInfrastructureDeployment: true, | ||
| }, | ||
| { | ||
| Name: "EN-With-KMS-Disabled", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this test case, we explicitly pass the key line 531, as we expect the user to do this in that flow. Or do you think we should raise the key up to the top level and never have them go to the lower level configurations?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think consumer should ever have to go to the lower level configurations to fill in a required value. Only if they want to override a value. The problem here is that KMS is required for current Observability DA. And until we add a "Full configurable" variation - I think we have to mark KMS as required in Observability DA
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually this is set at the top level which I think is the correct usage |
||
| Prefix: "ennokm", | ||
| Dependencies: []cloudinfo.AddonConfig{ | ||
| { | ||
| OfferingName: "deploy-arch-ibm-kms", | ||
| OfferingFlavor: "fully-configurable", | ||
daniel-butler-irl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Enabled: core.BoolPtr(false), | ||
| }, | ||
| }, | ||
| Inputs: map[string]interface{}{ | ||
| "existing_kms_instance_crn": permanentResources["kp_us_south_root_key_crn"], | ||
| }, | ||
| SkipInfrastructureDeployment: true, | ||
| }, | ||
| { | ||
| Name: "EN-With-COS-Disabled", | ||
| Prefix: "ennocs", | ||
| Dependencies: []cloudinfo.AddonConfig{ | ||
| { | ||
| OfferingName: "deploy-arch-ibm-cos", | ||
| OfferingFlavor: "instance", | ||
| Enabled: core.BoolPtr(false), | ||
| }, | ||
| }, | ||
| SkipInfrastructureDeployment: true, | ||
| }, | ||
| { | ||
| Name: "EN-With-Observability-Disabled", | ||
| Prefix: "ennoob", | ||
| Dependencies: []cloudinfo.AddonConfig{ | ||
| { | ||
| OfferingName: "deploy-arch-ibm-observability", | ||
| OfferingFlavor: "instances", | ||
| Enabled: core.BoolPtr(false), | ||
| }, | ||
| }, | ||
| SkipInfrastructureDeployment: true, | ||
| }, | ||
| { | ||
| Name: "EN-With-KMS-And-COS-Disabled", | ||
| Prefix: "enkmcno", | ||
| Dependencies: []cloudinfo.AddonConfig{ | ||
| { | ||
| OfferingName: "deploy-arch-ibm-kms", | ||
| OfferingFlavor: "fully-configurable", | ||
| Enabled: core.BoolPtr(false), | ||
| }, | ||
| { | ||
| OfferingName: "deploy-arch-ibm-cos", | ||
| OfferingFlavor: "instance", | ||
| Enabled: core.BoolPtr(false), | ||
| }, | ||
| }, | ||
| Inputs: map[string]interface{}{ | ||
| "existing_kms_instance_crn": permanentResources["kp_us_south_root_key_crn"], | ||
| }, | ||
| SkipInfrastructureDeployment: true, | ||
| }, | ||
| { | ||
| Name: "EN-With-KMS-And-Observability-Disabled", | ||
| Prefix: "enkmobno", | ||
| Dependencies: []cloudinfo.AddonConfig{ | ||
| { | ||
| OfferingName: "deploy-arch-ibm-kms", | ||
| OfferingFlavor: "fully-configurable", | ||
| Enabled: core.BoolPtr(false), | ||
| }, | ||
| { | ||
| OfferingName: "deploy-arch-ibm-observability", | ||
| OfferingFlavor: "instances", | ||
| Enabled: core.BoolPtr(false), | ||
| }, | ||
| }, | ||
| Inputs: map[string]interface{}{ | ||
| "existing_kms_instance_crn": permanentResources["kp_us_south_root_key_crn"], | ||
| }, | ||
| SkipInfrastructureDeployment: true, | ||
| }, | ||
| { | ||
| Name: "EN-With-COS-And-Observability-Disabled", | ||
| Prefix: "encobno", | ||
| Dependencies: []cloudinfo.AddonConfig{ | ||
| { | ||
| OfferingName: "deploy-arch-ibm-cos", | ||
| OfferingFlavor: "instance", | ||
| Enabled: core.BoolPtr(false), | ||
| }, | ||
| { | ||
| OfferingName: "deploy-arch-ibm-observability", | ||
| OfferingFlavor: "instances", | ||
| Enabled: core.BoolPtr(false), | ||
| }, | ||
| }, | ||
| SkipInfrastructureDeployment: true, | ||
| }, | ||
| { | ||
| Name: "EN-With-All-Optional-Services-Disabled", | ||
| Prefix: "enallno", | ||
| Dependencies: []cloudinfo.AddonConfig{ | ||
| { | ||
| OfferingName: "deploy-arch-ibm-kms", | ||
| OfferingFlavor: "fully-configurable", | ||
| Enabled: core.BoolPtr(false), | ||
| }, | ||
| { | ||
| OfferingName: "deploy-arch-ibm-cos", | ||
| OfferingFlavor: "instance", | ||
| Enabled: core.BoolPtr(false), | ||
| }, | ||
| { | ||
| OfferingName: "deploy-arch-ibm-observability", | ||
| OfferingFlavor: "instances", | ||
| Enabled: core.BoolPtr(false), | ||
| }, | ||
| }, | ||
| Inputs: map[string]interface{}{ | ||
| "existing_kms_instance_crn": permanentResources["kp_us_south_root_key_crn"], | ||
| }, | ||
| SkipInfrastructureDeployment: true, | ||
| }, | ||
| { | ||
| Name: "EN-With-KMS-Enabled-COS-Observability-Disabled", | ||
| Prefix: "enkmsy", | ||
| Dependencies: []cloudinfo.AddonConfig{ | ||
| { | ||
| OfferingName: "deploy-arch-ibm-cos", | ||
| OfferingFlavor: "instance", | ||
| Enabled: core.BoolPtr(false), | ||
| }, | ||
| { | ||
| OfferingName: "deploy-arch-ibm-observability", | ||
| OfferingFlavor: "instances", | ||
| Enabled: core.BoolPtr(false), | ||
| }, | ||
| }, | ||
| SkipInfrastructureDeployment: true, | ||
| }, | ||
| { | ||
| Name: "EN-With-COS-Enabled-KMS-Observability-Disabled", | ||
| Prefix: "encosy", | ||
| Dependencies: []cloudinfo.AddonConfig{ | ||
| { | ||
| OfferingName: "deploy-arch-ibm-kms", | ||
| OfferingFlavor: "fully-configurable", | ||
| Enabled: core.BoolPtr(false), | ||
| }, | ||
| { | ||
| OfferingName: "deploy-arch-ibm-observability", | ||
| OfferingFlavor: "instances", | ||
| Enabled: core.BoolPtr(false), | ||
| }, | ||
| }, | ||
| Inputs: map[string]interface{}{ | ||
| "existing_kms_instance_crn": permanentResources["kp_us_south_root_key_crn"], | ||
| }, | ||
| SkipInfrastructureDeployment: true, | ||
| }, | ||
| { | ||
| Name: "EN-With-Observability-Enabled-KMS-COS-Disabled", | ||
| Prefix: "enobsy", | ||
| Dependencies: []cloudinfo.AddonConfig{ | ||
| { | ||
| OfferingName: "deploy-arch-ibm-kms", | ||
| OfferingFlavor: "fully-configurable", | ||
| Enabled: core.BoolPtr(false), | ||
| }, | ||
| { | ||
| OfferingName: "deploy-arch-ibm-cos", | ||
| OfferingFlavor: "instance", | ||
| Enabled: core.BoolPtr(false), | ||
| }, | ||
| }, | ||
| Inputs: map[string]interface{}{ | ||
| "existing_kms_instance_crn": permanentResources["kp_us_south_root_key_crn"], | ||
| }, | ||
| SkipInfrastructureDeployment: true, | ||
| }, | ||
| { | ||
| Name: "EN-With-KMS-And-COS-Enabled-Observability-Disabled", | ||
| Prefix: "enkmcsy", | ||
| Dependencies: []cloudinfo.AddonConfig{ | ||
| { | ||
| OfferingName: "deploy-arch-ibm-observability", | ||
| OfferingFlavor: "instances", | ||
| Enabled: core.BoolPtr(false), | ||
| }, | ||
| }, | ||
| SkipInfrastructureDeployment: true, | ||
| }, | ||
| { | ||
| Name: "EN-With-KMS-And-Observability-Enabled-COS-Disabled", | ||
| Prefix: "enkmobsy", | ||
| Dependencies: []cloudinfo.AddonConfig{ | ||
| { | ||
| OfferingName: "deploy-arch-ibm-cos", | ||
| OfferingFlavor: "instance", | ||
| Enabled: core.BoolPtr(false), | ||
| }, | ||
| }, | ||
| SkipInfrastructureDeployment: true, | ||
| }, | ||
| { | ||
| Name: "EN-With-COS-And-Observability-Enabled-KMS-Disabled", | ||
| Prefix: "encobsy", | ||
| Dependencies: []cloudinfo.AddonConfig{ | ||
| { | ||
| OfferingName: "deploy-arch-ibm-kms", | ||
| OfferingFlavor: "fully-configurable", | ||
| Enabled: core.BoolPtr(false), | ||
| }, | ||
| }, | ||
| Inputs: map[string]interface{}{ | ||
| "existing_kms_instance_crn": permanentResources["kp_us_south_root_key_crn"], | ||
| }, | ||
| SkipInfrastructureDeployment: true, | ||
| }, | ||
| { | ||
| Name: "EN-With-All-Optional-Services-Enabled", | ||
| Prefix: "enallyes", | ||
| SkipInfrastructureDeployment: true, | ||
| }, | ||
| } | ||
|
|
||
| // Define common options that apply to all test cases | ||
| baseOptions := testaddons.TestAddonsOptionsDefault(&testaddons.TestAddonOptions{ | ||
| Testing: t, | ||
| Prefix: "en-matrix", // Test cases will override with their own prefixes | ||
| ResourceGroup: resourceGroup, | ||
| SkipLocalChangeCheck: true, // Skip local change check for addon tests | ||
| }) | ||
|
|
||
| matrix := testaddons.AddonTestMatrix{ | ||
| TestCases: testCases, | ||
| BaseOptions: baseOptions, | ||
| BaseSetupFunc: func(baseOptions *testaddons.TestAddonOptions, testCase testaddons.AddonTestCase) *testaddons.TestAddonOptions { | ||
| // The framework automatically handles prefix assignment from testCase.Prefix | ||
| return baseOptions | ||
| }, | ||
| AddonConfigFunc: func(options *testaddons.TestAddonOptions, testCase testaddons.AddonTestCase) cloudinfo.AddonConfig { | ||
| return cloudinfo.NewAddonConfigTerraform( | ||
| options.Prefix, | ||
| "deploy-arch-ibm-event-notifications", | ||
| "fully-configurable", | ||
| map[string]interface{}{ | ||
| "prefix": options.Prefix, | ||
| "region": validRegions[rand.Intn(len(validRegions))], | ||
| "enable_platform_metrics": "false", // Disable platform metrics for addon tests | ||
| }, | ||
| ) | ||
| }, | ||
| } | ||
|
|
||
| baseOptions.RunAddonTestMatrix(matrix) | ||
| } | ||

Uh oh!
There was an error while loading. Please reload this page.