Skip to content

Commit baf423f

Browse files
committed
test: add scale-test to workflow
Signed-off-by: Alex Castilio dos Santos <[email protected]>
1 parent 3e1a126 commit baf423f

File tree

7 files changed

+80
-249
lines changed

7 files changed

+80
-249
lines changed

Diff for: .github/workflows/scale-test-v2.yaml

+27-16
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@ permissions:
6868
contents: read
6969
id-token: write
7070

71+
env:
72+
RESOURCE_GROUP: ${{ inputs.resource_group }}
73+
CLUSTER_NAME: ${{ inputs.cluster_name }}
74+
TAG: RetinaVersion
75+
VM_SIZE: Standard_D4_v3
76+
LOCATION: westus2
77+
OUTPUT_FILEPATH: ./output.log
78+
7179
jobs:
7280
setup-cluster:
7381
if: ${{ github.event.inputs.create_cluster == 'true' }}
@@ -135,14 +143,6 @@ jobs:
135143
shell: bash
136144
run: az aks get-credentials --name $CLUSTER_NAME --resource-group $RESOURCE_GROUP --overwrite-existing
137145

138-
- name: Run Scale Test
139-
shell: bash
140-
run: |
141-
set -euo pipefail
142-
# Placeholder for test
143-
sleep 300 &
144-
echo "TEST_PID=$!" >> $GITHUB_ENV
145-
146146
- name: Clone ClusterLoader2
147147
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
148148
with:
@@ -163,18 +163,29 @@ jobs:
163163
mkdir test
164164
cp ../../.github/actions/cl2/* ./test -r
165165
go build ./cmd/clusterloader.go
166-
ls -l
167166
168-
- name: Run CL2
167+
- name: Run Scale Test
169168
shell: bash
169+
env:
170+
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION }}
171+
AZURE_APP_INSIGHTS_KEY: ${{ secrets.AZURE_APP_INSIGHTS_KEY }}
170172
run: |
171173
set -euo pipefail
172-
cd perf-tests/clusterloader2
173-
./clusterloader --testconfig=./test/config.yaml --provider=aks --kubeconfig=$HOME/.kube/config --v=2 --report-dir=./report
174-
175-
- name: Stop test
176-
shell: bash
177-
run: kill $TEST_PID
174+
# Placeholder for test
175+
go test ./test/e2e/. -v -tags=scale -timeout 300s -args -image-tag=$(make version) -create-infra=false -delete-infra=false
176+
177+
# - name: Run CL2
178+
# shell: bash
179+
# run: |
180+
# set -euo pipefail
181+
# cd perf-tests/clusterloader2
182+
# ./clusterloader --testconfig=./test/config.yaml --provider=aks --kubeconfig=$HOME/.kube/config --v=2 --report-dir=./report
183+
184+
# - name: Stop test
185+
# shell: bash
186+
# run: |
187+
# PID=$(ps aux | grep "go test" | awk '{print $2}')
188+
# kill -s 15 $PID
178189

179190
cleanup:
180191
name: Cleanup

Diff for: test/e2e/framework/scaletest/clusterloader2.go

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package scaletest
2+
3+
import (
4+
"fmt"
5+
"os"
6+
"os/exec"
7+
)
8+
9+
type ClusterLoader2 struct {}
10+
11+
func (d *ClusterLoader2) Prevalidate() error {
12+
return nil
13+
}
14+
15+
func (d *ClusterLoader2) Run() error {
16+
args := []string{
17+
"--testconfig=../../perf-tests/clusterloader2/test/config.yaml",
18+
"--provider=aks",
19+
"--kubeconfig=/home/runner/.kube/config",
20+
"--v=2",
21+
"--report-dir=../../perf-tests/clusterloader2/report",
22+
}
23+
cl2Path := "../../perf-tests/clusterloader2/clusterloader"
24+
cmd := exec.Command(cl2Path, args...)
25+
26+
cmd.Stdout = os.Stdout
27+
cmd.Stderr = os.Stderr
28+
29+
err := cmd.Run()
30+
if err != nil {
31+
return fmt.Errorf("Error executing CL2: %w", err)
32+
}
33+
34+
return nil
35+
}
36+
37+
func (d *ClusterLoader2) Stop() error {
38+
return nil
39+
}

Diff for: test/e2e/framework/scaletest/get-publish-metrics.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ func (g *GetAndPublishMetrics) Run() error {
4444
}
4545

4646
g.stop = make(chan struct{})
47+
4748
g.wg.Add(1)
4849

4950
go func() {
@@ -66,7 +67,6 @@ func (g *GetAndPublishMetrics) Run() error {
6667

6768
}
6869
}
69-
7070
}()
7171

7272
return nil

Diff for: test/e2e/framework/scaletest/options.go

+3-35
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,8 @@
11
package scaletest
22

3-
import "time"
4-
53
// Options holds parameters for the scale test
64
type Options struct {
7-
Namespace string
8-
MaxKwokPodsPerNode int
9-
NumKwokDeployments int
10-
NumKwokReplicas int
11-
MaxRealPodsPerNode int
12-
NumRealDeployments int
13-
RealPodType string
14-
NumRealReplicas int
15-
NumRealServices int
16-
NumNetworkPolicies int
17-
NumUnapliedNetworkPolicies int
18-
NumUniqueLabelsPerPod int
19-
NumUniqueLabelsPerDeployment int
20-
NumSharedLabelsPerPod int
21-
KubeconfigPath string
22-
RestartNpmPods bool
23-
DebugExitAfterPrintCounts bool
24-
DebugExitAfterGeneration bool
25-
SleepAfterCreation time.Duration
26-
DeleteKwokPods bool
27-
DeleteRealPods bool
28-
DeletePodsInterval time.Duration
29-
DeletePodsTimes int
30-
DeleteLabels bool
31-
DeleteLabelsInterval time.Duration
32-
DeleteLabelsTimes int
33-
DeleteNetworkPolicies bool
34-
DeleteNetworkPoliciesInterval time.Duration
35-
DeleteNetworkPoliciesTimes int
36-
numKwokPods int
37-
numRealPods int
38-
LabelsToGetMetrics map[string]string
39-
AdditionalTelemetryProperty map[string]string
5+
KubeconfigPath string
6+
LabelsToGetMetrics map[string]string
7+
AdditionalTelemetryProperty map[string]string
408
}

Diff for: test/e2e/framework/scaletest/validate-options.go

-49
This file was deleted.

Diff for: test/e2e/jobs/scale.go

+7-87
Original file line numberDiff line numberDiff line change
@@ -2,116 +2,36 @@ package retina
22

33
import (
44
"os"
5-
"time"
65

7-
"github.com/microsoft/retina/test/e2e/framework/kubernetes"
86
"github.com/microsoft/retina/test/e2e/framework/scaletest"
97
"github.com/microsoft/retina/test/e2e/framework/types"
108
)
119

1210
func DefaultScaleTestOptions() scaletest.Options {
1311
return scaletest.Options{
14-
Namespace: "scale-test",
15-
MaxKwokPodsPerNode: 0,
16-
NumKwokDeployments: 0,
17-
NumKwokReplicas: 0,
18-
MaxRealPodsPerNode: 100,
19-
NumRealDeployments: 1000,
20-
RealPodType: "kapinger",
21-
NumRealReplicas: 40,
22-
NumRealServices: 1000,
23-
NumNetworkPolicies: 10,
24-
NumUnapliedNetworkPolicies: 10,
25-
NumUniqueLabelsPerPod: 0,
26-
NumUniqueLabelsPerDeployment: 1,
27-
NumSharedLabelsPerPod: 3,
28-
KubeconfigPath: "",
29-
RestartNpmPods: false,
30-
SleepAfterCreation: 0,
31-
DeleteKwokPods: false,
32-
DeletePodsInterval: 60 * time.Second,
33-
DeleteRealPods: false,
34-
DeletePodsTimes: 1,
35-
DeleteLabels: false,
36-
DeleteLabelsInterval: 60 * time.Second,
37-
DeleteLabelsTimes: 1,
38-
DeleteNetworkPolicies: false,
39-
DeleteNetworkPoliciesInterval: 60 * time.Second,
40-
DeleteNetworkPoliciesTimes: 1,
41-
LabelsToGetMetrics: map[string]string{},
42-
AdditionalTelemetryProperty: map[string]string{},
12+
LabelsToGetMetrics: map[string]string{},
13+
AdditionalTelemetryProperty: map[string]string{},
4314
}
4415
}
4516

4617
func ScaleTest(opt *scaletest.Options) *types.Job {
4718
job := types.NewJob("Scale Test")
4819

49-
job.AddStep(&scaletest.ValidateAndPrintOptions{
50-
Options: opt,
51-
}, nil)
52-
53-
job.AddStep(&scaletest.ValidateNumOfNodes{
54-
KubeConfigFilePath: opt.KubeconfigPath,
55-
Label: map[string]string{"scale-test": "true"},
56-
NumNodesRequired: (opt.NumRealDeployments*opt.NumRealReplicas +
57-
opt.MaxRealPodsPerNode - 1) / opt.MaxRealPodsPerNode,
58-
}, nil)
59-
60-
job.AddStep(&kubernetes.DeleteNamespace{
61-
Namespace: opt.Namespace,
62-
}, nil)
63-
64-
job.AddStep(&kubernetes.CreateNamespace{}, nil)
65-
6620
job.AddStep(&scaletest.GetAndPublishMetrics{
21+
KubeConfigFilePath: opt.KubeconfigPath,
6722
Labels: opt.LabelsToGetMetrics,
6823
AdditionalTelemetryProperty: opt.AdditionalTelemetryProperty,
69-
OutputFilePath: os.Getenv("OUTPUT_FILEPATH"),
24+
OutputFilePath: os.Getenv("OUTPUT_FILEPATH"),
7025
}, &types.StepOptions{
7126
SkipSavingParametersToJob: true,
72-
RunInBackgroundWithID: "get-metrics",
27+
RunInBackgroundWithID: "metrics",
7328
})
7429

75-
job.AddStep(&scaletest.CreateResources{
76-
NumKwokDeployments: opt.NumKwokDeployments,
77-
NumKwokReplicas: opt.NumKwokReplicas,
78-
RealPodType: opt.RealPodType,
79-
NumRealDeployments: opt.NumRealDeployments,
80-
NumRealReplicas: opt.NumRealReplicas,
81-
NumRealServices: opt.NumRealServices,
82-
NumUniqueLabelsPerDeployment: opt.NumUniqueLabelsPerDeployment,
83-
}, nil)
84-
85-
job.AddStep(&scaletest.AddSharedLabelsToAllPods{
86-
NumSharedLabelsPerPod: opt.NumSharedLabelsPerPod,
87-
}, nil)
88-
89-
job.AddStep(&scaletest.AddUniqueLabelsToAllPods{
90-
NumUniqueLabelsPerPod: opt.NumUniqueLabelsPerPod,
91-
}, nil)
92-
93-
// Apply network policies (applied and unapplied)
94-
job.AddStep(&scaletest.CreateNetworkPolicies{
95-
NumNetworkPolicies: opt.NumNetworkPolicies,
96-
NumSharedLabelsPerPod: opt.NumSharedLabelsPerPod,
97-
}, nil)
98-
99-
job.AddStep(&kubernetes.WaitPodsReady{
100-
LabelSelector: "is-real=true",
101-
}, nil)
102-
103-
job.AddStep(&scaletest.DeleteAndReAddLabels{
104-
DeleteLabels: opt.DeleteLabels,
105-
DeleteLabelsInterval: opt.DeleteLabelsInterval,
106-
DeleteLabelsTimes: opt.DeleteLabelsTimes,
107-
NumSharedLabelsPerPod: opt.NumSharedLabelsPerPod,
108-
}, nil)
30+
job.AddStep(&scaletest.ClusterLoader2{}, nil)
10931

11032
job.AddStep(&types.Stop{
111-
BackgroundID: "get-metrics",
33+
BackgroundID: "metrics",
11234
}, nil)
11335

114-
job.AddStep(&kubernetes.DeleteNamespace{}, nil)
115-
11636
return job
11737
}

0 commit comments

Comments
 (0)