Skip to content

Commit bb2aeb3

Browse files
vipul-21jpayne3506
authored andcommitted
CI: [CNI] Replace the bash scripts for CNI load testing with golang test cases (#2003)
CI:[CNI] Replace the bash scripts with the golang test cases (cherry picked from commit 008ae45)
1 parent fb71cc5 commit bb2aeb3

21 files changed

+738
-310
lines changed

.pipelines/cni/cilium/cilium-cni-load-test.yaml

+20-17
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ stages:
1616
inlineScript: |
1717
set -ex
1818
make -C ./hack/swift azcfg AZCLI=az REGION=$(LOCATION)
19-
make -C ./hack/swift overlay-byocni-up AZCLI=az REGION=$(LOCATION) SUB=$(SUBSCRIPTION_ID) CLUSTER=${RESOURCE_GROUP} NODE_COUNT=10 VM_SIZE=Standard_DS4_v2
19+
make -C ./hack/swift overlay-no-kube-proxy-up AZCLI=az REGION=$(LOCATION) SUB=$(SUBSCRIPTION_ID) CLUSTER=${RESOURCE_GROUP}-$(make revision) NODE_COUNT=10 VM_SIZE=Standard_DS4_v2
2020
name: "CreateAksCluster"
2121
displayName: "Create AKS Cluster"
2222
- stage: install_cilium
@@ -35,7 +35,7 @@ stages:
3535
inlineScript: |
3636
set -ex
3737
az extension add --name aks-preview
38-
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${RESOURCE_GROUP}
38+
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${RESOURCE_GROUP}-$(make revision)
3939
ls -lah
4040
pwd
4141
kubectl cluster-info
@@ -72,10 +72,9 @@ stages:
7272
inlineScript: |
7373
set -ex
7474
az extension add --name aks-preview
75-
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${RESOURCE_GROUP}
76-
kubectl apply -f hack/manifests/pod.yaml
77-
kubectl apply -f hack/manifests/hostprocess.yaml
78-
bash hack/scripts/scale_deployment.sh
75+
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${RESOURCE_GROUP}-$(make revision)
76+
cd test/integration/load
77+
go test -timeout 30m -tags load -run ^TestLoad$ -tags=load -iterations=4 -scaleup=2400
7978
- stage: validate_state
8079
dependsOn: pod_deployment
8180
displayName: "Validate State"
@@ -89,9 +88,9 @@ stages:
8988
scriptType: "bash"
9089
addSpnToEnvironment: true
9190
inlineScript: |
92-
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${RESOURCE_GROUP}
91+
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${RESOURCE_GROUP}-$(make revision)
9392
kubectl get pods -A
94-
bash hack/scripts/validate_state.sh
93+
make test-validate-state
9594
name: "ValidateState"
9695
displayName: "Validate State"
9796
retryCountOnTaskFailure: 3
@@ -109,18 +108,22 @@ stages:
109108
addSpnToEnvironment: true
110109
inlineScript: |
111110
echo "Scale up the pods and immediated restart the nodes"
112-
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${RESOURCE_GROUP}
111+
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${RESOURCE_GROUP}-$(make revision)
113112
make -C ./hack/swift azcfg AZCLI=az REGION=$(LOCATION)
113+
cd test/integration/load
114114
echo "Scaling the pods down to 100 per node"
115-
bash ./hack/scripts/scale_deployment.sh -n 0 -u 1000 -s
115+
go test -count 1 -timeout 30m -tags load -run ^TestScaleDeployment$ -tags=load -scaleup=1000 -skip-wait=true
116+
cd ../../../
116117
echo "Restarting the nodes"
117118
vmss_name=$(az vmss list -g MC_${RESOURCE_GROUP}_${RESOURCE_GROUP}_$(LOCATION) --query "[].name" -o tsv)
118-
make -C ./hack/swift restart-vmss AZCLI=az CLUSTER=${RESOURCE_GROUP} REGION=$(LOCATION) VMSS_NAME=$vmss_name
119-
bash ./hack/scripts/scale_deployment.sh -n 0 -u 1000 -c
119+
make -C ./hack/swift restart-vmss AZCLI=az CLUSTER=${RESOURCE_GROUP}-$(make revision) REGION=$(LOCATION) VMSS_NAME=$vmss_name
120+
cd test/integration/load
121+
go test -count 1 -timeout 30m -tags load -run ^TestScaleDeployment$ -tags=load -replicas=1000
120122
name: "RestartNodes"
121123
displayName: "Restart Nodes"
122124
- script: |
123-
bash hack/scripts/validate_state.sh
125+
export RESTART_CASE=true
126+
make test-validate-state
124127
name: "ValidateState"
125128
displayName: "Validate State"
126129
retryCountOnTaskFailure: 3
@@ -148,11 +151,11 @@ stages:
148151
addSpnToEnvironment: true
149152
inlineScript: |
150153
set -ex
151-
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${RESOURCE_GROUP}
154+
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${RESOURCE_GROUP}-$(make revision)
152155
name: "GetCluster"
153156
displayName: "Get AKS Cluster"
154157
- script: |
155-
k delete deployment container -n default
158+
kubectl delete ns load-test
156159
cilium connectivity test
157160
retryCountOnTaskFailure: 6
158161
name: "CiliumConnectivityTests"
@@ -175,9 +178,9 @@ stages:
175178
if [ "$(DELETE_RESOURCES)" ]
176179
then
177180
echo "Deleting Cluster and resource group"
178-
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${RESOURCE_GROUP}
181+
make -C ./hack/swift set-kubeconf AZCLI=az CLUSTER=${RESOURCE_GROUP}-$(make revision)
179182
make -C ./hack/swift azcfg AZCLI=az REGION=$(LOCATION)
180-
make -C ./hack/swift down AZCLI=az REGION=$(LOCATION) SUB=$(SUBSCRIPTION_ID) CLUSTER=${RESOURCE_GROUP}
183+
make -C ./hack/swift down AZCLI=az REGION=$(LOCATION) SUB=$(SUBSCRIPTION_ID) CLUSTER=${RESOURCE_GROUP}-$(make revision)
181184
echo "Cluster and resources down"
182185
else
183186
echo "Deletion of resources is False"

.pipelines/singletenancy/cilium-overlay/cilium-overlay-e2e-step-template.yaml

+2-3
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,12 @@ steps:
134134
135135
- script: |
136136
echo "validate pod IP assignment and check systemd-networkd restart"
137-
kubectl apply -f hack/manifests/hostprocess.yaml
138137
kubectl get pod -owide -A
139-
bash hack/scripts/validate_state.sh
138+
make test-validate-state
140139
echo "delete cilium connectivity test resources and re-validate state"
141140
kubectl delete ns cilium-test
142141
kubectl get pod -owide -A
143-
bash hack/scripts/validate_state.sh
142+
make test-validate-state
144143
name: "validatePods"
145144
displayName: "Validate Pods"
146145

.pipelines/singletenancy/cilium/cilium-e2e-step-template.yaml

+2-3
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,12 @@ steps:
129129
130130
- script: |
131131
echo "validate pod IP assignment and check systemd-networkd restart"
132-
kubectl apply -f hack/manifests/hostprocess.yaml
133132
kubectl get pod -owide -A
134-
bash hack/scripts/validate_state.sh
133+
make test-validate-state
135134
echo "delete cilium connectivity test resources and re-validate state"
136135
kubectl delete ns cilium-test
137136
kubectl get pod -owide -A
138-
bash hack/scripts/validate_state.sh
137+
make test-validate-state
139138
name: "validatePods"
140139
displayName: "Validate Pods"
141140

Makefile

+6
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,8 @@ workspace: ## Set up the Go workspace.
701701
##@ Test
702702

703703
COVER_PKG ?= .
704+
#Restart case is used for cni load test pipeline for restarting the nodes cluster.
705+
RESTART_CASE ?= false
704706

705707
# COVER_FILTER omits folders with all files tagged with one of 'unit', '!ignore_uncovered', or '!ignore_autogenerated'
706708
test-all: ## run all unit tests.
@@ -713,6 +715,10 @@ test-integration: ## run all integration tests.
713715
CNS_VERSION=$(CNS_VERSION) \
714716
go test -mod=readonly -buildvcs=false -timeout 1h -coverpkg=./... -race -covermode atomic -coverprofile=coverage.out -tags=integration ./test/integration...
715717

718+
test-validate-state:
719+
cd test/integration/load && go test -count 1 -timeout 30m -tags load -run ^TestValidateState -tags=load -restart-case=$(RESTART_CASE)
720+
cd ../../..
721+
716722
test-cyclonus: ## run the cyclonus test for npm.
717723
cd test/cyclonus && bash ./test-cyclonus.sh
718724
cd ..

hack/scripts/scale_deployment.sh

-74
This file was deleted.

hack/scripts/validate_state.sh

-138
This file was deleted.

0 commit comments

Comments
 (0)