Skip to content

Commit

Permalink
try to improve test parallelism
Browse files Browse the repository at this point in the history
  • Loading branch information
lonegunmanb committed Dec 4, 2024
1 parent 978698b commit 45ec366
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
16 changes: 10 additions & 6 deletions test/e2e/terraform_aks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
)

func TestExamplesStartup(t *testing.T) {
t.Parallel()
vars := map[string]interface{}{
"client_id": "",
"client_secret": "",
Expand Down Expand Up @@ -45,6 +46,7 @@ func assertOutputNotEmpty(t *testing.T, output test_helper.TerraformOutput, name
}

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

func TestExamplesNamedCluster(t *testing.T) {
t.Parallel()
vars := make(map[string]interface{})
managedIdentityId := os.Getenv("MSI_ID")
if managedIdentityId != "" {
Expand Down Expand Up @@ -97,13 +100,15 @@ func TestExamplesNamedCluster(t *testing.T) {
}

func TestExamplesWithoutAssertion(t *testing.T) {
t.Parallel()
examples := []string{
"examples/with_acr",
"examples/multiple_node_pools",
}
for _, e := range examples {
example := e
t.Run(example, func(t *testing.T) {
t.Parallel()
test_helper.RunE2ETest(t, "../../", example, terraform.Options{
Upgrade: true,
}, nil)
Expand All @@ -112,6 +117,7 @@ func TestExamplesWithoutAssertion(t *testing.T) {
}

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

func TestExamples_applicationGatewayIngress(t *testing.T) {
t.Parallel()
useExistingAppGw := []struct {
useBrownFieldAppGw bool
bringYourOwnVnet bool
Expand All @@ -150,6 +157,7 @@ func TestExamples_applicationGatewayIngress(t *testing.T) {
}
for _, u := range useExistingAppGw {
t.Run(fmt.Sprintf("useExistingAppGw %t %t %t", u.bringYourOwnVnet, u.useBrownFieldAppGw, u.createRoleBindingForAppGw), func(t *testing.T) {
t.Parallel()
test_helper.RunE2ETest(t, "../../", "examples/application_gateway_ingress", terraform.Options{
Upgrade: true,
Vars: map[string]interface{}{
Expand Down Expand Up @@ -178,6 +186,7 @@ func TestExamples_applicationGatewayIngress(t *testing.T) {
}

func TestExamplesForV4(t *testing.T) {
t.Parallel()
examples, err := os.ReadDir("../../examples")
require.NoError(t, err)
for _, example := range examples {
Expand All @@ -188,12 +197,7 @@ func TestExamplesForV4(t *testing.T) {
continue
}
t.Run(example.Name(), func(t *testing.T) {
managedIdentityId := os.Getenv("MSI_ID")
if managedIdentityId != "" {
t.Setenv("TF_VAR_managed_identity_principal_id", managedIdentityId)
}
t.Setenv("TF_VAR_client_id", "")
t.Setenv("TF_VAR_client_secret", "")
t.Parallel()
tmp, err := os.MkdirTemp("", "")
require.NoError(t, err)
defer func() {
Expand Down
15 changes: 9 additions & 6 deletions test/upgrade/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
)

func TestExampleUpgrade_startup(t *testing.T) {
t.Parallel()
currentRoot, err := test_helper.GetCurrentModuleRootPath()
if err != nil {
t.FailNow()
Expand All @@ -38,6 +39,7 @@ func TestExampleUpgrade_startup(t *testing.T) {
}

func TestExampleUpgrade_without_monitor(t *testing.T) {
t.Parallel()
currentRoot, err := test_helper.GetCurrentModuleRootPath()
if err != nil {
t.FailNow()
Expand All @@ -60,6 +62,7 @@ func TestExampleUpgrade_without_monitor(t *testing.T) {
}

func TestExampleUpgrade_named_cluster(t *testing.T) {
t.Parallel()
currentRoot, err := test_helper.GetCurrentModuleRootPath()
if err != nil {
t.FailNow()
Expand All @@ -82,13 +85,15 @@ func TestExampleUpgrade_named_cluster(t *testing.T) {
}

func TestExampleUpgrade(t *testing.T) {
t.Parallel()
examples := []string{
"examples/with_acr",
"examples/multiple_node_pools",
}
for _, e := range examples {
example := e
t.Run(example, func(t *testing.T) {
t.Parallel()
currentRoot, err := test_helper.GetCurrentModuleRootPath()
if err != nil {
t.FailNow()
Expand All @@ -105,6 +110,7 @@ func TestExampleUpgrade(t *testing.T) {
}

func TestExampleUpgrade_applicationGw(t *testing.T) {
t.Parallel()
useExistingAppGw := []struct {
useBrownFieldAppGw bool
bringYourOwnVnet bool
Expand All @@ -128,6 +134,7 @@ func TestExampleUpgrade_applicationGw(t *testing.T) {
}
for _, u := range useExistingAppGw {
t.Run(fmt.Sprintf("useExistingAppGw %t %t %t", u.bringYourOwnVnet, u.useBrownFieldAppGw, u.createRoleBindingForAppGw), func(t *testing.T) {
t.Parallel()
currentRoot, err := test_helper.GetCurrentModuleRootPath()
if err != nil {
t.FailNow()
Expand All @@ -154,6 +161,7 @@ func TestExampleUpgrade_applicationGw(t *testing.T) {
}

func TestExamplesForV4(t *testing.T) {
t.Parallel()
examples, err := os.ReadDir("../../examples")
require.NoError(t, err)
currentRoot, err := test_helper.GetCurrentModuleRootPath()
Expand All @@ -172,12 +180,7 @@ func TestExamplesForV4(t *testing.T) {
continue
}
t.Run(example.Name(), func(t *testing.T) {
managedIdentityId := os.Getenv("MSI_ID")
if managedIdentityId != "" {
t.Setenv("TF_VAR_managed_identity_principal_id", managedIdentityId)
}
t.Setenv("TF_VAR_client_id", "")
t.Setenv("TF_VAR_client_secret", "")
t.Parallel()
tmp, err := os.MkdirTemp("", "")
require.NoError(t, err)
defer func() {
Expand Down

0 comments on commit 45ec366

Please sign in to comment.