Skip to content

Commit

Permalink
move flags to test/e2e/common
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Castilio dos Santos <[email protected]>
  • Loading branch information
alexcastilio committed Nov 22, 2024
1 parent 9d80cb0 commit 5fcfddd
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 19 deletions.
7 changes: 6 additions & 1 deletion test/e2e/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
package common

import (
"flag"
"os"
"os/user"
"strconv"
Expand All @@ -22,7 +23,11 @@ const (
TestPodNamespace = "kube-system-test"
)

var AzureLocations = []string{"eastus2", "northeurope", "uksouth", "centralindia", "westus2"}
var (
AzureLocations = []string{"eastus2", "northeurope", "uksouth", "centralindia", "westus2"}
CreateInfra = flag.Bool("create-infra", true, "create a Resource group, vNET and AKS cluster for testing")
DeleteInfra = flag.Bool("delete-infra", true, "delete a Resource group, vNET and AKS cluster for testing")
)

func ClusterNameForE2ETest(t *testing.T) string {
clusterName := os.Getenv("CLUSTER_NAME")
Expand Down
7 changes: 2 additions & 5 deletions test/e2e/retina_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package retina

import (
"crypto/rand"
"flag"
"math/big"
"os"
"path/filepath"
Expand All @@ -22,8 +21,6 @@ func TestE2ERetina(t *testing.T) {
ctx, cancel := helpers.Context(t)
defer cancel()

flag.Parse()

// Truncate the username to 8 characters
clusterName := common.ClusterNameForE2ETest(t)

Expand Down Expand Up @@ -57,11 +54,11 @@ func TestE2ERetina(t *testing.T) {
kubeConfigFilePath := filepath.Join(rootDir, "test", "e2e", "test.pem")

// CreateTestInfra
createTestInfra := types.NewRunner(t, jobs.CreateTestInfra(subID, rg, clusterName, location, kubeConfigFilePath, *createInfra))
createTestInfra := types.NewRunner(t, jobs.CreateTestInfra(subID, rg, clusterName, location, kubeConfigFilePath, *common.CreateInfra))
createTestInfra.Run(ctx)

t.Cleanup(func() {
if *deleteInfra {
if *common.DeleteInfra {
_ = jobs.DeleteTestInfra(subID, rg, clusterName, location).Run()
}
})
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/scale_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ func TestE2ERetina_Scale(t *testing.T) {
opt.LabelsToGetMetrics = map[string]string{"k8s-app": "retina"}

// CreateTestInfra
createTestInfra := types.NewRunner(t, jobs.CreateTestInfra(subID, rg, clusterName, location, kubeConfigFilePath, *createInfra))
createTestInfra := types.NewRunner(t, jobs.CreateTestInfra(subID, rg, clusterName, location, kubeConfigFilePath, *common.CreateInfra))
createTestInfra.Run(ctx)

t.Cleanup(func() {
if *deleteInfra {
if *common.DeleteInfra {
_ = jobs.DeleteTestInfra(subID, rg, clusterName, location).Run()
}
})
Expand Down
11 changes: 0 additions & 11 deletions test/e2e/shared_vars.go

This file was deleted.

0 comments on commit 5fcfddd

Please sign in to comment.