Skip to content

Commit

Permalink
Add integration tests for xDS flow control
Browse files Browse the repository at this point in the history
Signed-off-by: hanbingleixue <[email protected]>
  • Loading branch information
hanbingleixue committed Feb 25, 2025
1 parent f682ee5 commit 6b87e9d
Show file tree
Hide file tree
Showing 37 changed files with 2,313 additions and 26 deletions.
11 changes: 9 additions & 2 deletions .github/actions/common/plugin-change-check/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -932,13 +932,13 @@ runs:
# ==========dynamic config service is needed to test?==========
if [ ${{ env.sermantAgentCoreDynamicConfigServiceChanged }} == 'true' -o \
${{ steps.changed-common-action.outputs.changed }} == 'true' -o ${{ env.triggerPushEvent }} == 'true' ];then
echo "enableDynamicConfigServicAction=true" >> $GITHUB_ENV
echo "enableDynamicConfigServiceAction=true" >> $GITHUB_ENV
fi
# ==========xds service is needed to test?==========
if [ ${{ env.sermantAgentCoreXdsServiceChanged }} == 'true' -o \
${{ steps.changed-common-action.outputs.changed }} == 'true' -o ${{ env.triggerPushEvent }} == 'true' ];then
echo "enableXdsServicAction=true" >> $GITHUB_ENV
echo "enableXdsServiceAction=true" >> $GITHUB_ENV
fi
# ==========mq grayscale rocketmq is needed to test?==========
Expand All @@ -947,3 +947,10 @@ runs:
${{ steps.changed-common-action.outputs.changed }} == 'true' -o ${{ env.triggerPushEvent }} == 'true' ];then
echo "enableMqGrayscaleRocketMqAction=true" >> $GITHUB_ENV
fi
# ==========xds service is needed to test?==========
if [ ${{ env.sermantAgentCoreXdsServiceChanged }} == 'true' -o \
${{ steps.changed-common-action.outputs.changed }} == 'true' -o ${{ env.triggerPushEvent }} == 'true' -o \
${{ env.sermantFlowcontrolChanged }} == 'true'];then
echo "enableXdsFlowControl=true" >> $GITHUB_ENV
fi
97 changes: 97 additions & 0 deletions .github/actions/scenarios/xds-service/xds-flowcontrol/action.yml
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/flowcontrol/deployment/spring-client-sermant-xds-flowcontrol.yaml
kubectl delete -f sermant-integration-tests/xds-service-test/script/flowcontrol/deployment/spring-cloud-client-sermant-xds-flowcontrol.yaml
kubectl delete -f sermant-integration-tests/xds-service-test/script/flowcontrol/deployment/spring-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ runs:
cp -r sermant-integration-tests/xds-service-test/product/sermant-agent-*/agent sermant-integration-tests/xds-service-test/product/spring-client/
cp -r sermant-integration-tests/xds-service-test/product/sermant-agent-*/agent sermant-integration-tests/xds-service-test/product/spring-cloud-client/
cp -r sermant-integration-tests/xds-service-test/product/sermant-agent-*/agent sermant-integration-tests/xds-service-test/product/spring-server/
mvn 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-client,spring-cloud-client,spring-server -Pxds-router-lb --file \
mvn 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-router-lb --file \
sermant-integration-tests/xds-service-test/pom.xml
- name: build docker image
shell: bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ runs:
run: |
cp -r sermant-integration-tests/xds-service-test/product/sermant-agent-*/agent sermant-integration-tests/xds-service-test/product/spring-client/
cp -r sermant-integration-tests/xds-service-test/product/sermant-agent-*/agent sermant-integration-tests/xds-service-test/product/spring-server/
mvn package -DskipTests -pl spring-client,spring-server -Pxds-discovery --file \
mvn package -DskipTests -pl spring-common,spring-client,spring-server -Pxds-discovery --file \
sermant-integration-tests/xds-service-test/pom.xml
- name: build docker image
shell: bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ runs:
run: |
cp -r sermant-integration-tests/xds-service-test/product/sermant-agent-*/agent sermant-integration-tests/xds-service-test/product/spring-client/
cp -r sermant-integration-tests/xds-service-test/product/sermant-agent-*/agent sermant-integration-tests/xds-service-test/product/spring-server/
mvn package -DskipTests -pl spring-client,spring-server -Pxds-discovery --file \
mvn package -DskipTests -pl spring-common,spring-client,spring-server -Pxds-discovery --file \
sermant-integration-tests/xds-service-test/pom.xml
- name: build docker image
shell: bash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ runs:
run: |
cp -r sermant-integration-tests/xds-service-test/product/sermant-agent-*/agent sermant-integration-tests/xds-service-test/product/spring-client/
cp -r sermant-integration-tests/xds-service-test/product/sermant-agent-*/agent sermant-integration-tests/xds-service-test/product/spring-server/
mvn package -DskipTests -pl spring-client,spring-server -Pxds-discovery --file \
mvn package -DskipTests -pl spring-common,spring-client,spring-server -Pxds-discovery --file \
sermant-integration-tests/xds-service-test/pom.xml
- name: build docker image
shell: bash
Expand Down
94 changes: 83 additions & 11 deletions .github/workflows/agentcore_service_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ on:
- '.github/actions/common/exit/action.yml'
- 'sermant-plugins/sermant-router/router-common/**'
- 'sermant-plugins/sermant-router/spring-router-plugin/**'
- 'sermant-plugins/sermant-flowcontrol/**'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.head_ref }}
cancel-in-progress: true
Expand All @@ -39,15 +40,16 @@ jobs:
- name: set-outputs
id: set-outputs
run: |
echo "enableDynamicConfigServicAction=${{env.enableDynamicConfigServicAction}}" >> $GITHUB_OUTPUT
echo "enableXdsServicAction=${{env.enableXdsServicAction}}" >> $GITHUB_OUTPUT
echo "enableDynamicConfigServiceAction=${{env.enableDynamicConfigServiceAction}}" >> $GITHUB_OUTPUT
echo "enableXdsServiceAction=${{env.enableXdsServiceAction}}" >> $GITHUB_OUTPUT
echo "enableXdsFlowControl=${{env.enableXdsFlowControl}}" >> $GITHUB_OUTPUT
outputs:
enableDynamicConfigServicAction: ${{ steps.set-outputs.outputs.enableDynamicConfigServicAction }}
enableXdsServicAction: ${{ steps.set-outputs.outputs.enableXdsServicAction }}
enableDynamicConfigServiceAction: ${{ steps.set-outputs.outputs.enableDynamicConfigServiceAction }}
enableXdsServiceAction: ${{ steps.set-outputs.outputs.enableXdsServiceAction }}
download-midwares-and-cache:
name: download midwares and cache
runs-on: ubuntu-latest
if: needs.set-execution-conditions.outputs.enableDynamicConfigServicAction == 'true'
if: needs.set-execution-conditions.outputs.enableDynamicConfigServiceAction == 'true'
needs: [ set-execution-conditions ]
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -87,7 +89,7 @@ jobs:
build-agent-and-cache:
name: build agent and cache
runs-on: ubuntu-latest
if: needs.set-execution-conditions.outputs.enableDynamicConfigServicAction == 'true' || needs.set-execution-conditions.outputs.enableXdsServicAction == 'true'
if: needs.set-execution-conditions.outputs.enableDynamicConfigServiceAction == 'true' || needs.set-execution-conditions.outputs.enableXdsServiceAction == 'true'
needs: [set-execution-conditions]
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -126,7 +128,7 @@ jobs:
test-for-agentcore-dynamic-config:
name: Test for agentcore dynamic config
runs-on: ubuntu-latest
if: needs.set-execution-conditions.outputs.enableDynamicConfigServicAction == 'true'
if: needs.set-execution-conditions.outputs.enableDynamicConfigServiceAction == 'true'
needs: [ set-execution-conditions, build-agent-and-cache, download-midwares-and-cache ]
strategy:
matrix:
Expand All @@ -150,7 +152,7 @@ jobs:
test-for-xds-service-discovery-onlysermant:
name: Test for xds service discovery with only sermant
runs-on: ubuntu-latest
if: needs.set-execution-conditions.outputs.enableXdsServicAction == 'true'
if: needs.set-execution-conditions.outputs.enableXdsServiceAction == 'true'
needs: [set-execution-conditions, build-agent-and-cache]
steps:
- uses: actions/checkout@v4
Expand All @@ -166,7 +168,7 @@ jobs:
test-for-xds-service-discovery-with-server-envoy:
name: Test for xds service discovery with spring-server using envoy
runs-on: ubuntu-latest
if: needs.set-execution-conditions.outputs.enableXdsServicAction == 'true'
if: needs.set-execution-conditions.outputs.enableXdsServiceAction == 'true'
needs: [set-execution-conditions, build-agent-and-cache]
steps:
- uses: actions/checkout@v4
Expand All @@ -182,7 +184,7 @@ jobs:
test-for-xds-service-discovery-with-client-envoy:
name: Test for xds service discovery with spring-client using enovy
runs-on: ubuntu-latest
if: needs.set-execution-conditions.outputs.enableXdsServicAction == 'true'
if: needs.set-execution-conditions.outputs.enableXdsServiceAction == 'true'
needs: [set-execution-conditions, build-agent-and-cache]
steps:
- uses: actions/checkout@v4
Expand All @@ -198,7 +200,7 @@ jobs:
test-for-xds-router-lb:
name: Test for xds router and lb with router plugin
runs-on: ubuntu-latest
if: needs.set-execution-conditions.outputs.enableXdsServicAction == 'true'
if: needs.set-execution-conditions.outputs.enableXdsServiceAction == 'true'
needs: [set-execution-conditions, build-agent-and-cache]
strategy:
matrix:
Expand Down Expand Up @@ -264,3 +266,73 @@ jobs:
uses: ./.github/actions/common/xds-service
- name: xds router and lb test
uses: ./.github/actions/scenarios/xds-service/xds-router-lb
test-for-xds-flowcontrol:
name: Test for xds flow control
runs-on: ubuntu-latest
if: needs.set-execution-conditions.outputs.enableXdsServiceAction == 'true'
|| needs.set-execution-conditions.outputs.enableXdsFlowControl == 'true'
needs: [ set-execution-conditions, build-agent-and-cache ]
strategy:
matrix:
include:
- springBootVersion: "2.0.2.RELEASE"
snakeyamlVersion: "1.19"
springCloudVersion: "Finchley.RELEASE"
httpClientVersion: "4.4"
okHttp2Version: "2.2.0"
okHttp3Version: "3.5.0"
httpAsyncClientVersion: "4.0.1"
- springBootVersion: "2.1.0.RELEASE"
snakeyamlVersion: "1.23"
springCloudVersion: "Greenwich.RELEASE"
httpClientVersion: "4.4.1"
okHttp2Version: "2.3.0"
okHttp3Version: "3.9.1"
httpAsyncClientVersion: "4.0.2"
- springBootVersion: "2.2.0.RELEASE"
snakeyamlVersion: "1.25"
springCloudVersion: "Hoxton.RELEASE"
httpClientVersion: "4.5"
okHttp2Version: "2.4.0"
okHttp3Version: "3.12.13"
httpAsyncClientVersion: "4.1"
- springBootVersion: "2.3.0.RELEASE"
snakeyamlVersion: "1.26"
springCloudVersion: "Hoxton.RELEASE"
httpClientVersion: "4.5.3"
okHttp2Version: "2.5.0"
okHttp3Version: "3.14.9"
httpAsyncClientVersion: "4.1.1"
- springBootVersion: "2.4.0"
snakeyamlVersion: "1.27"
springCloudVersion: "2020.0.0"
httpClientVersion: "4.5.7"
okHttp2Version: "2.6.0"
okHttp3Version: "4.2.2"
httpAsyncClientVersion: "4.1.2"
- springBootVersion: "2.6.2"
snakeyamlVersion: "1.29"
springCloudVersion: "2021.0.0"
httpClientVersion: "4.5.10"
okHttp2Version: "2.7.3"
okHttp3Version: "4.7.2"
httpAsyncClientVersion: "4.1.3"
- springBootVersion: "2.7.17"
snakeyamlVersion: "1.30"
springCloudVersion: "2021.0.3"
httpClientVersion: "4.5.13"
okHttp2Version: "2.7.5"
okHttp3Version: "4.12.0"
httpAsyncClientVersion: "4.1.5"
fail-fast: false
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 100
- name: set java version to environment
run: |
echo "javaVersion=8" >> $GITHUB_ENV
- name: xds common operation
uses: ./.github/actions/common/xds-service
- name: xds flow control test
uses: ./.github/actions/scenarios/xds-service/xds-flowcontrol
Loading

0 comments on commit 6b87e9d

Please sign in to comment.