Skip to content

Commit

Permalink
test: add hubble control plane to scale test
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 29, 2024
1 parent 5ff1567 commit 422dbf4
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 5 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/scale-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ on:
image_tag:
description: "Image Tag (if not set, default for this commit will be used)"
type: string
control_plane:
description: "Control Plane"
type: choice
required: true
options:
- "legacy"
- "hubble"
num_deployments:
description: "Number of Traffic Deployments"
default: 1000
Expand Down Expand Up @@ -100,6 +107,7 @@ jobs:
IMAGE_NAMESPACE: ${{ github.repository }}
TAG: ${{ inputs.image_tag }}
AZURE_APP_INSIGHTS_KEY: ${{ secrets.AZURE_APP_INSIGHTS_KEY }}
HUBBLE_CONTROL_PLANE: ${{ inputs.control_plane == 'hubble' }}
shell: bash
run: |
set -euo pipefail
Expand Down
17 changes: 17 additions & 0 deletions test/e2e/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"flag"
"os"
"os/user"
"path/filepath"
"strconv"
"testing"
"time"
Expand Down Expand Up @@ -46,3 +47,19 @@ func ClusterNameForE2ETest(t *testing.T) string {
}
return clusterName
}

func RetinaChartPath(hubbleControlPlane bool) (string, error) {
cwd, err := os.Getwd()
if err != nil {
return "", err
}

rootDir := filepath.Dir(filepath.Dir(cwd))
controlPlane := "legacy"

if hubbleControlPlane {
controlPlane = "hubble"
}

return filepath.Join(rootDir, "deploy", controlPlane, "manifests", "controller", "helm", "retina"), nil
}
20 changes: 17 additions & 3 deletions test/e2e/jobs/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,23 @@ func DeleteTestInfra(subID, rg, clusterName, location string) *types.Job {
return job
}

func InstallRetina(kubeConfigFilePath, chartPath string) *types.Job {
job := types.NewJob("Install and test Retina with basic metrics")
func InstallRetina(kubeConfigFilePath, chartPath string, hubbleControlPlane bool) *types.Job {
if hubbleControlPlane {
job := types.NewJob("Install Retina with Hubble Control Plane")

// Install Retina with Hubble Control Plane
job.AddStep(&kubernetes.ValidateHubbleStep{
Namespace: common.KubeSystemNamespace,
ReleaseName: "retina",
KubeConfigFilePath: kubeConfigFilePath,
ChartPath: chartPath,
TagEnv: generic.DefaultTagEnv,
}, nil)

return job
}

job := types.NewJob("Install Retina with Legacy Control Plane")

job.AddStep(&kubernetes.InstallHelmChart{
Namespace: common.KubeSystemNamespace,
Expand Down Expand Up @@ -365,4 +380,3 @@ func RunPerfTest(kubeConfigFilePath string, chartPath string) *types.Job {

return job
}

12 changes: 10 additions & 2 deletions test/e2e/scale_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"os"
"path/filepath"
"strconv"
"strings"
"testing"

"github.com/microsoft/retina/test/e2e/common"
Expand Down Expand Up @@ -49,7 +50,6 @@ func TestE2ERetina_Scale(t *testing.T) {
// Get to root of the repo by going up two directories
rootDir := filepath.Dir(filepath.Dir(cwd))

chartPath := filepath.Join(rootDir, "deploy", "legacy", "manifests", "controller", "helm", "retina")
kubeConfigFilePath := filepath.Join(rootDir, "test", "e2e", "test.pem")

// Scale test parameters
Expand Down Expand Up @@ -103,8 +103,16 @@ func TestE2ERetina_Scale(t *testing.T) {
require.NoError(t, err)
opt.AdditionalTelemetryProperty["clusterFqdn"] = fqdn

var hubbleControlPlane bool
if strings.ToLower(os.Getenv("HUBBLE_CONTROL_PLANE")) == "true" {
hubbleControlPlane = true
}

chartPath, err := common.RetinaChartPath(hubbleControlPlane)
require.NoError(t, err)

// Install Retina
installRetina := types.NewRunner(t, jobs.InstallRetina(kubeConfigFilePath, chartPath))
installRetina := types.NewRunner(t, jobs.InstallRetina(kubeConfigFilePath, chartPath, hubbleControlPlane))
installRetina.Run(ctx)

t.Cleanup(func() {
Expand Down

0 comments on commit 422dbf4

Please sign in to comment.