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 20, 2024
1 parent effbc1d commit 5eca841
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 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
5 changes: 2 additions & 3 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,6 +54,8 @@ func TestE2ERetina(t *testing.T) {
kubeConfigFilePath := filepath.Join(rootDir, "test", "e2e", "test.pem")

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

Expand Down
3 changes: 3 additions & 0 deletions test/e2e/scale_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ func TestE2ERetina_Scale(t *testing.T) {

opt.LabelsToGetMetrics = map[string]string{"k8s-app": "retina"}

createInfra := common.CreateInfra
deleteInfra := common.DeleteInfra

// CreateTestInfra
createTestInfra := types.NewRunner(t, jobs.CreateTestInfra(subID, rg, clusterName, location, kubeConfigFilePath, *createInfra))
createTestInfra.Run(ctx)
Expand Down
11 changes: 0 additions & 11 deletions test/e2e/shared_vars.go

This file was deleted.

0 comments on commit 5eca841

Please sign in to comment.