Skip to content

Commit 01a158f

Browse files
ci: upgrade test cases
1 parent 33821d1 commit 01a158f

File tree

2 files changed

+73
-5
lines changed

2 files changed

+73
-5
lines changed

tests/common-go-assets/cloudinfo-region-power-prefs.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,9 @@
55
- name: eu-de-1
66
useForTest: true
77
testPriority: 2
8+
- name: tor01
9+
useForTest: true
10+
testPriority: 3
11+
- name: tok04
12+
useForTest: true
13+
testPriority: 4

tests/pr_test.go

Lines changed: 67 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
// Use existing resource group
1616
const resourceGroup = "geretain-test-resources"
1717
const defaultExampleTerraformDir = "solutions/standard"
18+
const quickstartExampleTerraformDir = "solutions/standard-plus-vsi"
1819

1920
var sharedInfoSvc *cloudinfo.CloudInfoService
2021

@@ -33,7 +34,7 @@ func TestMain(m *testing.M) {
3334
os.Exit(m.Run())
3435
}
3536

36-
func setupOptions(t *testing.T, prefix string) *testhelper.TestOptions {
37+
func setupOptionsStandardSolution(t *testing.T, prefix string) *testhelper.TestOptions {
3738

3839
options := testhelper.TestOptionsDefault(&testhelper.TestOptions{
3940
Testing: t,
@@ -70,19 +71,80 @@ func setupOptions(t *testing.T, prefix string) *testhelper.TestOptions {
7071
return options
7172
}
7273

73-
func TestRunBranchExample(t *testing.T) {
74+
func TestRunBranchStandardExample(t *testing.T) {
7475
t.Parallel()
7576

76-
options := setupOptions(t, "pvs-i-b")
77+
options := setupOptionsStandardSolution(t, "pvs-i-b")
7778

7879
output, err := options.RunTestConsistency()
7980
assert.Nil(t, err, "This should not have errored")
8081
assert.NotNil(t, output, "Expected some output")
8182
}
8283

83-
func TestRunMainExample(t *testing.T) {
84+
func TestRunMainStandardExample(t *testing.T) {
8485
t.Parallel()
85-
options := setupOptions(t, "pvs-i-m")
86+
options := setupOptionsStandardSolution(t, "pvs-i-m")
87+
88+
output, err := options.RunTestUpgrade()
89+
if !options.UpgradeTestSkipped {
90+
assert.Nil(t, err, "This should not have errored")
91+
assert.NotNil(t, output, "Expected some output")
92+
}
93+
}
94+
95+
// quickstart =standard-plus-vsi
96+
func setupOptionsQuickstartSolution(t *testing.T, prefix string) *testhelper.TestOptions {
97+
98+
options := testhelper.TestOptionsDefault(&testhelper.TestOptions{
99+
Testing: t,
100+
TerraformDir: quickstartExampleTerraformDir,
101+
Prefix: prefix,
102+
ResourceGroup: resourceGroup,
103+
Region: "us-south", // specify default region to skip best choice query
104+
DefaultRegion: "dal10",
105+
BestRegionYAMLPath: "./common-go-assets/cloudinfo-region-power-prefs.yaml", // specific to powervs zones
106+
// temporary workaround for BSS backend issue
107+
ImplicitDestroy: []string{
108+
"module.standard.module.landing_zone.module.landing_zone.ibm_resource_group.resource_groups",
109+
},
110+
})
111+
112+
// query for best zone to deploy powervs example, based on current connection count
113+
// NOTE: this is why we do not want to run multiple tests in parallel.
114+
options.Region, _ = testhelper.GetBestPowerSystemsRegionO(options.RequiredEnvironmentVars["TF_VAR_ibmcloud_api_key"], options.BestRegionYAMLPath, options.DefaultRegion,
115+
testhelper.TesthelperTerraformOptions{CloudInfoService: sharedInfoSvc})
116+
// if for any reason the region is empty at this point, such as error, use default
117+
if len(options.Region) == 0 {
118+
options.Region = options.DefaultRegion
119+
}
120+
121+
options.TerraformVars = map[string]interface{}{
122+
"prefix": options.Prefix,
123+
"powervs_resource_group_name": options.ResourceGroup,
124+
"external_access_ip": "0.0.0.0/0",
125+
"tshirt_size": map[string]string{
126+
"image": "7300-02-01",
127+
"tshirt_size": "aix_xs",
128+
},
129+
"powervs_zone": options.Region,
130+
}
131+
132+
return options
133+
}
134+
135+
func TestRunBranchQuickstartExample(t *testing.T) {
136+
t.Parallel()
137+
138+
options := setupOptionsQuickstartSolution(t, "pvs-qs-b")
139+
140+
output, err := options.RunTestConsistency()
141+
assert.Nil(t, err, "This should not have errored")
142+
assert.NotNil(t, output, "Expected some output")
143+
}
144+
145+
func TestRunMainQuickstartExample(t *testing.T) {
146+
t.Parallel()
147+
options := setupOptionsQuickstartSolution(t, "pvs-qs-m")
86148

87149
output, err := options.RunTestUpgrade()
88150
if !options.UpgradeTestSkipped {

0 commit comments

Comments
 (0)