Skip to content

Commit bacc55b

Browse files
authored
test: cleanup tests (#567)
1 parent d466a2b commit bacc55b

File tree

2 files changed

+61
-59
lines changed

2 files changed

+61
-59
lines changed

tests/other_test.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// Tests in this file are NOT run in the PR pipeline. They are run in the continuous testing pipeline along with the ones in pr_test.go
2+
package test
3+
4+
import (
5+
"testing"
6+
7+
"github.com/stretchr/testify/assert"
8+
)
9+
10+
// NOTE: The HPCS tests may fail if our account already has an existing hpcs auth policy - hence only running once a week so PR pipeline is not impacted
11+
func TestRunRoksPatternWithHPCS(t *testing.T) {
12+
t.Parallel()
13+
14+
options := setupOptionsRoksPattern(t, "ocp-hp")
15+
16+
options.TerraformVars["hs_crypto_instance_name"] = permanentResources["hpcs_name_south"]
17+
options.TerraformVars["hs_crypto_resource_group"] = permanentResources["hpcs_rg_south"]
18+
19+
output, err := options.RunTestConsistency()
20+
assert.Nil(t, err, "This should not have errored")
21+
assert.NotNil(t, output, "Expected some output")
22+
}
23+
24+
func TestRunVSIPatternWithHPCS(t *testing.T) {
25+
// Purposely not running in parallel so it does not clash with the auth policies created in "TestRunRoksPatternWithHPCS"
26+
// t.Parallel()
27+
28+
options := setupOptionsVsiPattern(t, "vsi-hp")
29+
30+
options.TerraformVars["hs_crypto_instance_name"] = permanentResources["hpcs_name_south"]
31+
options.TerraformVars["hs_crypto_resource_group"] = permanentResources["hpcs_rg_south"]
32+
33+
output, err := options.RunTestConsistency()
34+
assert.Nil(t, err, "This should not have errored")
35+
assert.NotNil(t, output, "Expected some output")
36+
}

tests/pr_test.go

Lines changed: 25 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@ const yamlLocation = "../common-dev-assets/common-go-assets/common-permanent-res
2323
// Setting "add_atracker_route" to false for VPC and VSI tests to avoid hitting AT route quota, right now its 4 routes per account.
2424
const add_atracker_route = false
2525

26-
// Temp: the atracker_target ignore is being tracked in https://github.ibm.com/GoldenEye/issues/issues/4302
27-
var ignoreUpdates = []string{
28-
"module.landing_zone.module.landing_zone.ibm_atracker_target.atracker_target[0]",
29-
"module.landing_zone.ibm_atracker_target.atracker_target[0]",
30-
}
31-
3226
var sharedInfoSvc *cloudinfo.CloudInfoService
3327
var permanentResources map[string]interface{}
3428

@@ -66,9 +60,6 @@ func setupOptionsQuickStartPattern(t *testing.T, prefix string, dir string) *tes
6660
TerraformVars: map[string]interface{}{
6761
"ssh_key": sshPublicKey,
6862
},
69-
IgnoreUpdates: testhelper.Exemptions{
70-
List: ignoreUpdates,
71-
},
7263
CloudInfoService: sharedInfoSvc,
7364
})
7465

@@ -78,7 +69,7 @@ func setupOptionsQuickStartPattern(t *testing.T, prefix string, dir string) *tes
7869
func TestRunQuickStartPattern(t *testing.T) {
7970
t.Parallel()
8071

81-
options := setupOptionsQuickStartPattern(t, "slz-qs", quickStartPatternTerraformDir)
72+
options := setupOptionsQuickStartPattern(t, "vsi-qs", quickStartPatternTerraformDir)
8273

8374
output, err := options.RunTestConsistency()
8475
assert.Nil(t, err, "This should not have errored")
@@ -89,10 +80,7 @@ func TestRunUpgradeQuickStartPattern(t *testing.T) {
8980

9081
t.Parallel()
9182

92-
// TODO: Remove this line after QuickStart pattern is merged to primary branch to enable upgrade test
93-
t.Skip("Skipping upgrade test until QuickStart pattern is merged to primary branch")
94-
95-
options := setupOptionsQuickStartPattern(t, "slz-qs-ug", quickStartPatternTerraformDir)
83+
options := setupOptionsQuickStartPattern(t, "vsi-qs-u", quickStartPatternTerraformDir)
9684

9785
output, err := options.RunTestUpgrade()
9886
if !options.UpgradeTestSkipped {
@@ -103,39 +91,27 @@ func TestRunUpgradeQuickStartPattern(t *testing.T) {
10391

10492
func setupOptionsRoksPattern(t *testing.T, prefix string) *testhelper.TestOptions {
10593

106-
sshPublicKey := sshPublicKey(t)
107-
10894
options := testhelper.TestOptionsDefault(&testhelper.TestOptions{
109-
Testing: t,
110-
TerraformDir: roksPatternTerraformDir,
111-
Prefix: prefix,
112-
ResourceGroup: resourceGroup,
113-
IgnoreUpdates: testhelper.Exemptions{
114-
List: ignoreUpdates,
115-
},
95+
Testing: t,
96+
TerraformDir: roksPatternTerraformDir,
97+
Prefix: prefix,
98+
ResourceGroup: resourceGroup,
11699
CloudInfoService: sharedInfoSvc,
117100
})
118101

119102
options.TerraformVars = map[string]interface{}{
120-
"ssh_public_key": sshPublicKey,
121-
"prefix": options.Prefix,
122-
"tags": options.Tags,
123-
"region": options.Region,
103+
"prefix": options.Prefix,
104+
"tags": options.Tags,
105+
"region": options.Region,
124106
}
125107

126108
return options
127109
}
128110

129-
func TestRunRoksPatternWithHPCS(t *testing.T) {
111+
func TestRunRoksPattern(t *testing.T) {
130112
t.Parallel()
131113

132-
options := setupOptionsRoksPattern(t, "lrkshp")
133-
134-
// TODO: Use HPCS instead of Key Protect for tests once the auth policy issue is fixed. Issue: https://github.ibm.com/GoldenEye/issues/issues/5138
135-
136-
// Key Protect service will be used if `hs_crypto_instance_name` is null
137-
// options.TerraformVars["hs_crypto_instance_name"] = permanentResources["hpcs_name_south"]
138-
// options.TerraformVars["hs_crypto_resource_group"] = permanentResources["hpcs_rg_south"]
114+
options := setupOptionsRoksPattern(t, "ocp")
139115

140116
output, err := options.RunTestConsistency()
141117
assert.Nil(t, err, "This should not have errored")
@@ -145,7 +121,7 @@ func TestRunRoksPatternWithHPCS(t *testing.T) {
145121
func TestRunUpgradeRoksPattern(t *testing.T) {
146122
t.Parallel()
147123

148-
options := setupOptionsRoksPattern(t, "r-ug")
124+
options := setupOptionsRoksPattern(t, "ocp-u")
149125

150126
output, err := options.RunTestUpgrade()
151127
if !options.UpgradeTestSkipped {
@@ -159,13 +135,10 @@ func setupOptionsVsiPattern(t *testing.T, prefix string) *testhelper.TestOptions
159135
sshPublicKey := sshPublicKey(t)
160136

161137
options := testhelper.TestOptionsDefault(&testhelper.TestOptions{
162-
Testing: t,
163-
TerraformDir: vsiPatternTerraformDir,
164-
Prefix: prefix,
165-
ResourceGroup: resourceGroup,
166-
IgnoreUpdates: testhelper.Exemptions{
167-
List: ignoreUpdates,
168-
},
138+
Testing: t,
139+
TerraformDir: vsiPatternTerraformDir,
140+
Prefix: prefix,
141+
ResourceGroup: resourceGroup,
169142
CloudInfoService: sharedInfoSvc,
170143
})
171144

@@ -183,7 +156,7 @@ func setupOptionsVsiPattern(t *testing.T, prefix string) *testhelper.TestOptions
183156
func TestRunUpgradeVsiPattern(t *testing.T) {
184157
t.Parallel()
185158

186-
options := setupOptionsVsiPattern(t, "vp-ug")
159+
options := setupOptionsVsiPattern(t, "vsi-u")
187160

188161
output, err := options.RunTestUpgrade()
189162
if !options.UpgradeTestSkipped {
@@ -192,14 +165,10 @@ func TestRunUpgradeVsiPattern(t *testing.T) {
192165
}
193166
}
194167

195-
func TestRunVSIPatternWithHPCS(t *testing.T) {
196-
options := setupOptionsVsiPattern(t, "lvsihp")
197-
198-
// TODO: Use HPCS instead of Key Protect for tests once the auth policy issue is fixed. Issue: https://github.ibm.com/GoldenEye/issues/issues/5138
168+
func TestRunVSIPattern(t *testing.T) {
169+
t.Parallel()
199170

200-
// Key Protect service will be used if `hs_crypto_instance_name` is null
201-
// options.TerraformVars["hs_crypto_instance_name"] = permanentResources["hpcs_name_south"]
202-
// options.TerraformVars["hs_crypto_resource_group"] = permanentResources["hpcs_rg_south"]
171+
options := setupOptionsVsiPattern(t, "vsi")
203172

204173
output, err := options.RunTestConsistency()
205174
assert.Nil(t, err, "This should not have errored")
@@ -209,13 +178,10 @@ func TestRunVSIPatternWithHPCS(t *testing.T) {
209178
func setupOptionsVpcPattern(t *testing.T, prefix string) *testhelper.TestOptions {
210179

211180
options := testhelper.TestOptionsDefault(&testhelper.TestOptions{
212-
Testing: t,
213-
TerraformDir: vpcPatternTerraformDir,
214-
Prefix: prefix,
215-
ResourceGroup: resourceGroup,
216-
IgnoreUpdates: testhelper.Exemptions{
217-
List: ignoreUpdates,
218-
},
181+
Testing: t,
182+
TerraformDir: vpcPatternTerraformDir,
183+
Prefix: prefix,
184+
ResourceGroup: resourceGroup,
219185
CloudInfoService: sharedInfoSvc,
220186
})
221187

@@ -232,7 +198,7 @@ func setupOptionsVpcPattern(t *testing.T, prefix string) *testhelper.TestOptions
232198
func TestRunVpcPattern(t *testing.T) {
233199
t.Parallel()
234200

235-
options := setupOptionsVpcPattern(t, "p-vpc")
201+
options := setupOptionsVpcPattern(t, "vpc")
236202

237203
output, err := options.RunTestConsistency()
238204
assert.Nil(t, err, "This should not have errored")

0 commit comments

Comments
 (0)