forked from sermant-io/Sermant
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration tests for xDS flow control
Signed-off-by: hanbingleixue <[email protected]>
- Loading branch information
1 parent
3b26d06
commit 7c12692
Showing
30 changed files
with
3,219 additions
and
2,382 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
97 changes: 97 additions & 0 deletions
97
.github/actions/scenarios/xds-service/xds-flowcontrol/action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
name: "xDS router an lb Test" | ||
description: "Auto test for xds router and lb with router plugin" | ||
runs: | ||
using: composite | ||
steps: | ||
- name: prepare image | ||
shell: bash | ||
run: | | ||
echo -e "plugins:\n - flowcontrol" > sermant-agent-${{ env.sermantVersion }}/agent/config/plugins.yaml | ||
sudo sed -i '/x-sermant-retriable-status-codes:/a\ \ \ - 502' sermant-agent-${{ env.sermantVersion }}/agent/pluginPackage/flowcontrol/config/config.yaml | ||
sudo sed -i '/x-sermant-retriable-header-names:/a\ \ \ - needRetry' sermant-agent-${{ env.sermantVersion }}/agent/pluginPackage/flowcontrol/config/config.yaml | ||
cat sermant-agent-${{ env.sermantVersion }}/agent/config/plugins.yaml | ||
cat sermant-agent-${{ env.sermantVersion }}/agent/pluginPackage/flowcontrol/config/config.yaml | ||
cp -r sermant-agent-*/agent sermant-integration-tests/xds-service-test/product/spring-client/ | ||
cp -r sermant-agent-*/agent sermant-integration-tests/xds-service-test/product/spring-cloud-client/ | ||
cp -r sermant-agent-*/agent sermant-integration-tests/xds-service-test/product/spring-server/ | ||
mvn clean package -Dspringboot.version=${{ matrix.springBootVersion }} -Dsnakeyaml.version=${{ matrix.snakeyamlVersion }} -Dspringcloud.version=${{ matrix.springCloudVersion }} -Dhttpclient.version=${{ matrix.httpClientVersion }} -Dokhttp2.version=${{ matrix.okHttp2Version }} -Dhttpclient.async.version=${{ matrix.httpAsyncClientVersion }} -Dokhttp3.version=${{ matrix.okHttp3Version }} -DskipTests -pl spring-common,spring-client,spring-cloud-client,spring-server -Pxds-flowcontrol --file sermant-integration-tests/xds-service-test/pom.xml | ||
- name: build docker image | ||
shell: bash | ||
run: | | ||
cd sermant-integration-tests/xds-service-test/product/spring-server/ | ||
minikube image build -t spring-server:1.0.0 . | ||
cd ../spring-client/ | ||
minikube image build -t spring-client:1.0.0 . | ||
cd ../spring-cloud-client/ | ||
minikube image build -t spring-cloud-client:1.0.0 . | ||
eval $(minikube docker-env) | ||
docker images | ||
- name: start zookeeper | ||
shell: bash | ||
run: | | ||
kubectl apply -f sermant-integration-tests/xds-service-test/script/zookeeper.yaml | ||
kubectl wait --for=condition=ready pod -l app=zookeeper --timeout=10s | ||
sleep 15s | ||
- name: start spring-client | ||
shell: bash | ||
run: | | ||
kubectl apply -f sermant-integration-tests/xds-service-test/script/flowcontrol/deployment/spring-client-sermant-xds-flowcontrol.yaml | ||
kubectl wait --for=condition=ready pod -l app=spring-client --timeout=10s | ||
sleep 15s | ||
nohup kubectl port-forward svc/spring-client 8080:8080 & | ||
sleep 2s | ||
bash ./sermant-integration-tests/scripts/checkService.sh http://127.0.0.1:8080/checkStatus 150 | ||
- name: start spring-cloud-client | ||
shell: bash | ||
run: | | ||
kubectl apply -f sermant-integration-tests/xds-service-test/script/flowcontrol/deployment/spring-cloud-client-sermant-xds-flowcontrol.yaml | ||
kubectl wait --for=condition=ready pod -l app=spring-cloud-client --timeout=10s | ||
sleep 15s | ||
nohup kubectl port-forward svc/spring-cloud-client 8082:8082 & | ||
sleep 2s | ||
bash ./sermant-integration-tests/scripts/checkService.sh http://127.0.0.1:8082/router/checkStatus 150 | ||
- name: start spring-server | ||
shell: bash | ||
run: | | ||
kubectl apply -f sermant-integration-tests/xds-service-test/script/flowcontrol/deployment/spring-server.yaml | ||
kubectl wait --for=condition=ready pod -l app=spring-server --timeout=10s | ||
sleep 15s | ||
nohup kubectl port-forward svc/spring-server 8081:8081 & | ||
sleep 100s | ||
bash ./sermant-integration-tests/scripts/checkService.sh http://127.0.0.1:8081/hello 150 | ||
bash ./sermant-integration-tests/scripts/checkService.sh http://127.0.0.1:8081/hello 150 | ||
bash ./sermant-integration-tests/scripts/checkService.sh "http://127.0.0.1:8080/flowControl/testHttpClient?host=spring-server&version=v1&path=testFault" 150 | ||
bash ./sermant-integration-tests/scripts/checkService.sh "http://127.0.0.1:8080/flowControl/testOkHttp2?host=spring-server&version=v1&path=testFault" 150 | ||
bash ./sermant-integration-tests/scripts/checkService.sh "http://127.0.0.1:8080/flowControl/testHttpUrlConnection?host=spring-server&version=v1&path=testFault" 150 | ||
bash ./sermant-integration-tests/scripts/checkService.sh "http://127.0.0.1:8082/flowControl/testOkHttp3?host=spring-server&version=v1&path=testFault" 150 | ||
pkill -f "kubectl port-forward svc/spring-server" | ||
- name: test flowcontrol | ||
shell: bash | ||
run: | | ||
kubectl apply -f sermant-integration-tests/xds-service-test/script/flowcontrol/flowcontrol-rule/spring-server-destination-circuitbreaker.yaml | ||
kubectl apply -f sermant-integration-tests/xds-service-test/script/flowcontrol/flowcontrol-rule/spring-server-virtureservice-fault.yaml | ||
sleep 5s | ||
mvn test -Dxds.service.integration.test.type=FLOW_CONTROL_FAULT --file \ | ||
sermant-integration-tests/xds-service-test/xds-service-integration-test/pom.xml | ||
kubectl delete -f sermant-integration-tests/xds-service-test/script/flowcontrol/flowcontrol-rule/spring-server-virtureservice-fault.yaml | ||
kubectl apply -f sermant-integration-tests/xds-service-test/script/flowcontrol/flowcontrol-rule/spring-server-virtureservice-retry.yaml | ||
sleep 5s | ||
mvn test -Dxds.service.integration.test.type=FLOW_CONTROL_RETRY --file \ | ||
sermant-integration-tests/xds-service-test/xds-service-integration-test/pom.xml | ||
kubectl delete -f sermant-integration-tests/xds-service-test/script/flowcontrol/flowcontrol-rule/spring-server-virtureservice-retry.yaml | ||
kubectl apply -f sermant-integration-tests/xds-service-test/script/flowcontrol/flowcontrol-rule/spring-server-virtureservice-circuitbreaker.yaml | ||
sleep 5s | ||
mvn test -Dxds.service.integration.test.type=FLOW_CONTROL_CIRCUIT_BREAKER --file \ | ||
sermant-integration-tests/xds-service-test/xds-service-integration-test/pom.xml | ||
kubectl delete -f sermant-integration-tests/xds-service-test/script/flowcontrol/flowcontrol-rule/spring-server-virtureservice-circuitbreaker.yaml | ||
kubectl apply -f sermant-integration-tests/xds-service-test/script/flowcontrol/flowcontrol-rule/spring-server-virtureservice-ratelimit.yaml | ||
kubectl apply -f sermant-integration-tests/xds-service-test/script/flowcontrol/flowcontrol-rule/spring-server-envoyfilter.yaml | ||
sleep 5s | ||
mvn test -Dxds.service.integration.test.type=FLOW_CONTROL_RATE_LIMIT --file \ | ||
sermant-integration-tests/xds-service-test/xds-service-integration-test/pom.xml | ||
- name: close all service | ||
shell: bash | ||
run: | | ||
kubectl delete -f sermant-integration-tests/xds-service-test/script/router/deployment/spring-client-sermant-xds-flowcontrol.yaml | ||
kubectl delete -f sermant-integration-tests/xds-service-test/script/router/deployment/spring-cloud-client-sermant-xds-flowcontrol.yaml | ||
kubectl delete -f sermant-integration-tests/xds-service-test/script/router/deployment/spring-server.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,58 @@ | ||
name: Unit test and code coverage | ||
on: [push, pull_request] | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.head_ref }} | ||
cancel-in-progress: true | ||
jobs: | ||
build: | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
java_version: [8] | ||
os: [ubuntu-22.04] | ||
permissions: | ||
checks: write | ||
contents: write | ||
pull-requests: write | ||
statuses: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up JDK ${{ matrix.java_version }} | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: ${{ matrix.java_version }} | ||
distribution: 'adopt' | ||
cache: maven | ||
- name: Cache Maven packages | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.m2 | ||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: ${{ runner.os }}-m2 | ||
- name: download sc | ||
run: | | ||
curl -o apache-servicecomb-service-center-2.1.0-linux-amd64.tar.gz -L https://github.com/apache/servicecomb-service-center/releases/download/v2.1.0/apache-servicecomb-service-center-2.1.0-linux-amd64.tar.gz | ||
tar -zxf apache-servicecomb-service-center-2.1.0-linux-amd64.tar.gz | ||
sh apache-servicecomb-service-center-2.1.0-linux-amd64/start-service-center.sh | ||
- name: download zookeeper | ||
run: | | ||
curl -o apache-zookeeper-3.6.3-bin.tar.gz -L https://archive.apache.org/dist/zookeeper/zookeeper-3.6.3/apache-zookeeper-3.6.3-bin.tar.gz | ||
tar -zxf apache-zookeeper-3.6.3-bin.tar.gz | ||
bash apache-zookeeper-3.6.3-bin/bin/zkServer.sh start apache-zookeeper-3.6.3-bin/conf/zoo_sample.cfg | ||
- name: download nacos | ||
run: | | ||
curl -o nacos-server-2.1.0.tar.gz -L https://github.com/alibaba/nacos/releases/download/2.1.0/nacos-server-2.1.0.tar.gz | ||
tar -zxf nacos-server-2.1.0.tar.gz | ||
bash nacos/bin/startup.sh -m standalone | ||
- name: Build with Maven | ||
run: mvn test | ||
- name: Generate code coverage report | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
files: ${{ github.workspace }}/report/target/jacoco/jacoco.xml | ||
flags: unittests | ||
fail_ci_if_error: true # optional (default = false) | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
#name: Unit test and code coverage | ||
#on: [push, pull_request] | ||
#concurrency: | ||
# group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.head_ref }} | ||
# cancel-in-progress: true | ||
#jobs: | ||
# build: | ||
# runs-on: ubuntu-22.04 | ||
# strategy: | ||
# fail-fast: false | ||
# matrix: | ||
# java_version: [8] | ||
# os: [ubuntu-22.04] | ||
# permissions: | ||
# checks: write | ||
# contents: write | ||
# pull-requests: write | ||
# statuses: write | ||
# steps: | ||
# - name: Checkout | ||
# uses: actions/checkout@v4 | ||
# - name: Set up JDK ${{ matrix.java_version }} | ||
# uses: actions/setup-java@v4 | ||
# with: | ||
# java-version: ${{ matrix.java_version }} | ||
# distribution: 'adopt' | ||
# cache: maven | ||
# - name: Cache Maven packages | ||
# uses: actions/cache@v4 | ||
# with: | ||
# path: ~/.m2 | ||
# key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | ||
# restore-keys: ${{ runner.os }}-m2 | ||
# - name: download sc | ||
# run: | | ||
# curl -o apache-servicecomb-service-center-2.1.0-linux-amd64.tar.gz -L https://github.com/apache/servicecomb-service-center/releases/download/v2.1.0/apache-servicecomb-service-center-2.1.0-linux-amd64.tar.gz | ||
# tar -zxf apache-servicecomb-service-center-2.1.0-linux-amd64.tar.gz | ||
# sh apache-servicecomb-service-center-2.1.0-linux-amd64/start-service-center.sh | ||
# - name: download zookeeper | ||
# run: | | ||
# curl -o apache-zookeeper-3.6.3-bin.tar.gz -L https://archive.apache.org/dist/zookeeper/zookeeper-3.6.3/apache-zookeeper-3.6.3-bin.tar.gz | ||
# tar -zxf apache-zookeeper-3.6.3-bin.tar.gz | ||
# bash apache-zookeeper-3.6.3-bin/bin/zkServer.sh start apache-zookeeper-3.6.3-bin/conf/zoo_sample.cfg | ||
# - name: download nacos | ||
# run: | | ||
# curl -o nacos-server-2.1.0.tar.gz -L https://github.com/alibaba/nacos/releases/download/2.1.0/nacos-server-2.1.0.tar.gz | ||
# tar -zxf nacos-server-2.1.0.tar.gz | ||
# bash nacos/bin/startup.sh -m standalone | ||
# - name: Build with Maven | ||
# run: mvn test | ||
# - name: Generate code coverage report | ||
# uses: codecov/codecov-action@v4 | ||
# with: | ||
# files: ${{ github.workspace }}/report/target/jacoco/jacoco.xml | ||
# flags: unittests | ||
# fail_ci_if_error: true # optional (default = false) | ||
# env: | ||
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
Oops, something went wrong.