Skip to content

Commit 45ec366

Browse files
committed
try to improve test parallelism
1 parent 978698b commit 45ec366

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

test/e2e/terraform_aks_test.go

+10-6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
)
1919

2020
func TestExamplesStartup(t *testing.T) {
21+
t.Parallel()
2122
vars := map[string]interface{}{
2223
"client_id": "",
2324
"client_secret": "",
@@ -45,6 +46,7 @@ func assertOutputNotEmpty(t *testing.T, output test_helper.TerraformOutput, name
4546
}
4647

4748
func TestExamplesWithoutMonitor(t *testing.T) {
49+
t.Parallel()
4850
vars := make(map[string]interface{}, 0)
4951
managedIdentityId := os.Getenv("MSI_ID")
5052
if managedIdentityId != "" {
@@ -70,6 +72,7 @@ func TestExamplesWithoutMonitor(t *testing.T) {
7072
}
7173

7274
func TestExamplesNamedCluster(t *testing.T) {
75+
t.Parallel()
7376
vars := make(map[string]interface{})
7477
managedIdentityId := os.Getenv("MSI_ID")
7578
if managedIdentityId != "" {
@@ -97,13 +100,15 @@ func TestExamplesNamedCluster(t *testing.T) {
97100
}
98101

99102
func TestExamplesWithoutAssertion(t *testing.T) {
103+
t.Parallel()
100104
examples := []string{
101105
"examples/with_acr",
102106
"examples/multiple_node_pools",
103107
}
104108
for _, e := range examples {
105109
example := e
106110
t.Run(example, func(t *testing.T) {
111+
t.Parallel()
107112
test_helper.RunE2ETest(t, "../../", example, terraform.Options{
108113
Upgrade: true,
109114
}, nil)
@@ -112,6 +117,7 @@ func TestExamplesWithoutAssertion(t *testing.T) {
112117
}
113118

114119
func TestExamples_differentLocationForLogAnalyticsSolution(t *testing.T) {
120+
t.Parallel()
115121
vars := make(map[string]any, 0)
116122
managedIdentityId := os.Getenv("MSI_ID")
117123
if managedIdentityId != "" {
@@ -127,6 +133,7 @@ func TestExamples_differentLocationForLogAnalyticsSolution(t *testing.T) {
127133
}
128134

129135
func TestExamples_applicationGatewayIngress(t *testing.T) {
136+
t.Parallel()
130137
useExistingAppGw := []struct {
131138
useBrownFieldAppGw bool
132139
bringYourOwnVnet bool
@@ -150,6 +157,7 @@ func TestExamples_applicationGatewayIngress(t *testing.T) {
150157
}
151158
for _, u := range useExistingAppGw {
152159
t.Run(fmt.Sprintf("useExistingAppGw %t %t %t", u.bringYourOwnVnet, u.useBrownFieldAppGw, u.createRoleBindingForAppGw), func(t *testing.T) {
160+
t.Parallel()
153161
test_helper.RunE2ETest(t, "../../", "examples/application_gateway_ingress", terraform.Options{
154162
Upgrade: true,
155163
Vars: map[string]interface{}{
@@ -178,6 +186,7 @@ func TestExamples_applicationGatewayIngress(t *testing.T) {
178186
}
179187

180188
func TestExamplesForV4(t *testing.T) {
189+
t.Parallel()
181190
examples, err := os.ReadDir("../../examples")
182191
require.NoError(t, err)
183192
for _, example := range examples {
@@ -188,12 +197,7 @@ func TestExamplesForV4(t *testing.T) {
188197
continue
189198
}
190199
t.Run(example.Name(), func(t *testing.T) {
191-
managedIdentityId := os.Getenv("MSI_ID")
192-
if managedIdentityId != "" {
193-
t.Setenv("TF_VAR_managed_identity_principal_id", managedIdentityId)
194-
}
195-
t.Setenv("TF_VAR_client_id", "")
196-
t.Setenv("TF_VAR_client_secret", "")
200+
t.Parallel()
197201
tmp, err := os.MkdirTemp("", "")
198202
require.NoError(t, err)
199203
defer func() {

test/upgrade/upgrade_test.go

+9-6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
)
1616

1717
func TestExampleUpgrade_startup(t *testing.T) {
18+
t.Parallel()
1819
currentRoot, err := test_helper.GetCurrentModuleRootPath()
1920
if err != nil {
2021
t.FailNow()
@@ -38,6 +39,7 @@ func TestExampleUpgrade_startup(t *testing.T) {
3839
}
3940

4041
func TestExampleUpgrade_without_monitor(t *testing.T) {
42+
t.Parallel()
4143
currentRoot, err := test_helper.GetCurrentModuleRootPath()
4244
if err != nil {
4345
t.FailNow()
@@ -60,6 +62,7 @@ func TestExampleUpgrade_without_monitor(t *testing.T) {
6062
}
6163

6264
func TestExampleUpgrade_named_cluster(t *testing.T) {
65+
t.Parallel()
6366
currentRoot, err := test_helper.GetCurrentModuleRootPath()
6467
if err != nil {
6568
t.FailNow()
@@ -82,13 +85,15 @@ func TestExampleUpgrade_named_cluster(t *testing.T) {
8285
}
8386

8487
func TestExampleUpgrade(t *testing.T) {
88+
t.Parallel()
8589
examples := []string{
8690
"examples/with_acr",
8791
"examples/multiple_node_pools",
8892
}
8993
for _, e := range examples {
9094
example := e
9195
t.Run(example, func(t *testing.T) {
96+
t.Parallel()
9297
currentRoot, err := test_helper.GetCurrentModuleRootPath()
9398
if err != nil {
9499
t.FailNow()
@@ -105,6 +110,7 @@ func TestExampleUpgrade(t *testing.T) {
105110
}
106111

107112
func TestExampleUpgrade_applicationGw(t *testing.T) {
113+
t.Parallel()
108114
useExistingAppGw := []struct {
109115
useBrownFieldAppGw bool
110116
bringYourOwnVnet bool
@@ -128,6 +134,7 @@ func TestExampleUpgrade_applicationGw(t *testing.T) {
128134
}
129135
for _, u := range useExistingAppGw {
130136
t.Run(fmt.Sprintf("useExistingAppGw %t %t %t", u.bringYourOwnVnet, u.useBrownFieldAppGw, u.createRoleBindingForAppGw), func(t *testing.T) {
137+
t.Parallel()
131138
currentRoot, err := test_helper.GetCurrentModuleRootPath()
132139
if err != nil {
133140
t.FailNow()
@@ -154,6 +161,7 @@ func TestExampleUpgrade_applicationGw(t *testing.T) {
154161
}
155162

156163
func TestExamplesForV4(t *testing.T) {
164+
t.Parallel()
157165
examples, err := os.ReadDir("../../examples")
158166
require.NoError(t, err)
159167
currentRoot, err := test_helper.GetCurrentModuleRootPath()
@@ -172,12 +180,7 @@ func TestExamplesForV4(t *testing.T) {
172180
continue
173181
}
174182
t.Run(example.Name(), func(t *testing.T) {
175-
managedIdentityId := os.Getenv("MSI_ID")
176-
if managedIdentityId != "" {
177-
t.Setenv("TF_VAR_managed_identity_principal_id", managedIdentityId)
178-
}
179-
t.Setenv("TF_VAR_client_id", "")
180-
t.Setenv("TF_VAR_client_secret", "")
183+
t.Parallel()
181184
tmp, err := os.MkdirTemp("", "")
182185
require.NoError(t, err)
183186
defer func() {

0 commit comments

Comments
 (0)