Skip to content

Commit

Permalink
增加rocketmq插件流水测试
Browse files Browse the repository at this point in the history
Signed-off-by: chengyouling <[email protected]>
  • Loading branch information
chengyouling committed Dec 19, 2024
1 parent 214a423 commit 922ad63
Show file tree
Hide file tree
Showing 24 changed files with 2,300 additions and 0 deletions.
83 changes: 83 additions & 0 deletions .github/actions/common/mq-grayscale/rocketmq/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: "Rocketmq Message Gray Common operations"
description: "Do something common for rocketmq message gray"
runs:
using: "composite"
steps:
- name: Set up JDK ${{ env.javaVersion }}
uses: actions/setup-java@v4
with:
java-version: ${{ env.javaVersion }}
distribution: 'adopt'
cache: maven
- name: download agent
uses: actions/cache@v4
with:
path: sermant-agent-*/
key: ${{ runner.os }}-agent-${{ github.run_id }}
- name: get cse from cache
uses: actions/cache@v4
with:
path: Local-CSE-2.1.3-linux-amd64.zip
key: ${{ runner.os }}-local-cse
restore-keys: |
${{ runner.os }}-local-cse
- name: start cse
shell: bash
run: |
export ROOT_PATH=$(pwd)
bash ./sermant-integration-tests/scripts/startCse.sh
- name: get rocketmq from cache
uses: actions/cache@v4
with:
path: rocketmq-all-4.8.0-bin-release.zip
key: ${{ runner.os }}-rocketmq-all-4.8.0-bin-release
restore-keys: |
${{ runner.os }}-rocketmq-all-4.8.0-bin-release
- name: get rocketmq514 from cache
uses: actions/cache@v4
with:
path: rocketmq-all-5.1.4-bin-release.zip
key: ${{ runner.os }}-rocketmq-all-5.1.4-bin-release
restore-keys: |
${{ runner.os }}-rocketmq-all-5.1.4-bin-release
- name: start rocketmq server
shell: bash
if: matrix.rocketMqClientVersion != '5.0.0' || (matrix.rocketMqClientVersion == '5.0.0' && matrix.test-model != 'PLUGIN_ENABLED_FALSE_LITE_PULL' && matrix.test-model != 'CONSUMER_BASE_ONLY_LITE_PULL' && matrix.test-model != 'CONSUMER_BASE_GRAY_LITE_PULL')
run: |
unzip rocketmq-all-4.8.0-bin-release.zip
sed -i 's/if \[\[ "$JAVA_MAJOR_VERSION" -lt "9" \]\]/if [ "$JAVA_MAJOR_VERSION" -lt "9" ]/g' rocketmq-all-4.8.0-bin-release/bin/runserver.sh
sed -i 's/-Xms4g -Xmx4g -Xmn2g/-Xms1g -Xmx1g -Xmn1g/g' rocketmq-all-4.8.0-bin-release/bin/runserver.sh
sed -i '22i enablePropertyFilter = true' rocketmq-all-4.8.0-bin-release/conf/broker.conf
nohup bash rocketmq-all-4.8.0-bin-release/bin/mqnamesrv &
- name: start rocketmq broker
shell: bash
if: matrix.rocketMqClientVersion != '5.0.0' || (matrix.rocketMqClientVersion == '5.0.0' && matrix.test-model != 'PLUGIN_ENABLED_FALSE_LITE_PULL' && matrix.test-model != 'CONSUMER_BASE_ONLY_LITE_PULL' && matrix.test-model != 'CONSUMER_BASE_GRAY_LITE_PULL')
run: |
sed -i 's/-Xms8g -Xmx8g -Xmn4g/-Xms1g -Xmx1g -Xmn1g/g' rocketmq-all-4.8.0-bin-release/bin/runbroker.sh
nohup bash rocketmq-all-4.8.0-bin-release/bin/mqbroker -n localhost:9876 -c rocketmq-all-4.8.0-bin-release/conf/broker.conf &
- name: start rocketmq514 server
shell: bash
if: (matrix.test-model == 'PLUGIN_ENABLED_FALSE_LITE_PULL' || matrix.test-model == 'CONSUMER_BASE_ONLY_LITE_PULL' || matrix.test-model == 'CONSUMER_BASE_GRAY_LITE_PULL') && matrix.rocketMqClientVersion == '5.0.0'
run: |
unzip rocketmq-all-5.1.4-bin-release.zip
sed -i 's/if \[\[ "$JAVA_MAJOR_VERSION" -lt "9" \]\]/if [ "$JAVA_MAJOR_VERSION" -lt "9" ]/g' rocketmq-all-5.1.4-bin-release/bin/runserver.sh
sed -i 's/-Xms4g -Xmx4g -Xmn2g/-Xms1g -Xmx1g -Xmn1g/g' rocketmq-all-5.1.4-bin-release/bin/runserver.sh
sed -i '22i enablePropertyFilter = true' rocketmq-all-5.1.4-bin-release/conf/broker.conf
nohup bash rocketmq-all-5.1.4-bin-release/bin/mqnamesrv &
- name: start rocketmq514 broker
shell: bash
if: (matrix.test-model == 'PLUGIN_ENABLED_FALSE_LITE_PULL' || matrix.test-model == 'CONSUMER_BASE_ONLY_LITE_PULL' || matrix.test-model == 'CONSUMER_BASE_GRAY_LITE_PULL') && matrix.rocketMqClientVersion == '5.0.0'
run: |
sed -i 's/-Xms8g -Xmx8g -Xmn4g/-Xms1g -Xmx1g -Xmn1g/g' rocketmq-all-5.1.4-bin-release/bin/runbroker.sh
nohup bash rocketmq-all-5.1.4-bin-release/bin/mqbroker -n localhost:9876 -c rocketmq-all-5.1.4-bin-release/conf/broker.conf &
- name: cache dependencies
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: entry
uses: ./.github/actions/common/entry
with:
log-dir: ./logs/rocketmq-grayscale/common
23 changes: 23 additions & 0 deletions .github/actions/common/plugin-change-check/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,22 @@ runs:
shell: bash
run: |
echo "crossthreadTagTransmissionChanged=${{ steps.changed-tag-transmission-crossthread.outputs.changed }}" >> $GITHUB_ENV
- uses: ktamas77/[email protected]
id: changed-mq-grayscale-rocketmq
with:
paths: sermant-plugins/sermant-mq-grayscale/mq-config-common
sermant-plugins/sermant-mq-grayscale/mq-config-service
sermant-plugins/sermant-mq-grayscale/mq-grayscale-rocketmq-plugin
sermant-integration-tests/mq-grayscale-rocketmq-test/grayscale-rocketmq-consumer-demo
sermant-integration-tests/mq-grayscale-rocketmq-test/grayscale-rocketmq-producer-demo
sermant-integration-tests/mq-grayscale-rocketmq-test/grayscale-rocketmq-integration-test
./.github/workflows/message_gray_integration_test.yml
./.github/actions/common/mq-grayscale/rocketmq
./.github/actions/scenarios/mq-grayscale/rocketmq
- name: env mq-grayscale-rocketmq
shell: bash
run: |
echo "mqGrayscaleRocketMqChanged=${{ steps.changed-mq-grayscale-rocketmq.outputs.changed }}" >> $GITHUB_ENV
- uses: ktamas77/[email protected]
id: changed-dubbo-router-action
with:
Expand Down Expand Up @@ -924,3 +940,10 @@ runs:
${{ steps.changed-common-action.outputs.changed }} == 'true' -o ${{ env.triggerPushEvent }} == 'true' ];then
echo "enableXdsServicAction=true" >> $GITHUB_ENV
fi
# ==========mq grayscale rocketmq is needed to test?==========
if [ ${{ env.mqGrayscaleRocketMqChanged }} == 'true' -o \
${{ env.sermantAgentCoreChanged }} == 'true' -o \
${{ steps.changed-common-action.outputs.changed }} == 'true' -o ${{ env.triggerPushEvent }} == 'true' ];then
echo "enableMqGrayscaleRocketMqAction=true" >> $GITHUB_ENV
fi
86 changes: 86 additions & 0 deletions .github/actions/scenarios/mq-grayscale/rocketmq/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: "RocketMq Grayscale Test"
description: "Auto test for rocketMq grayscale"
runs:
using: "composite"
steps:
- name: package rocketmq grayscale tests
shell: bash
run: mvn package -Drocketmq-client.version=${{ matrix.rocketMqClientVersion }} -DskipTests --file sermant-integration-tests/mq-grayscale-rocketmq-test/pom.xml
- name: echo test model
shell: bash
run: |
echo "=======test-model======"-${{ matrix.test-model }}
- name: start base producer service
shell: bash
env:
dynamic.config.dynamicConfigType: KIE
dynamic.config.serverAddress: 127.0.0.1:30110
SERVICE_META_ENVIRONMENT: development
run: |
nohup java -javaagent:sermant-agent-${{ env.sermantVersion }}/agent/sermant-agent.jar=appName=grayscale-rocketmq-producer -jar \
sermant-integration-tests/mq-grayscale-rocketmq-test/grayscale-rocketmq-producer-demo/target/grayscale-rocketmq-producer-demo.jar > ${{ env.logDir }}/rocketmq-producer-base.log 2>&1 &
- name: start gray producer service
shell: bash
env:
dynamic.config.dynamicConfigType: KIE
dynamic.config.serverAddress: 127.0.0.1:30110
SERVICE_META_ENVIRONMENT: development
SERVICE_META_VERSION: 1.0.1
run: |
nohup java -javaagent:sermant-agent-${{ env.sermantVersion }}/agent/sermant-agent.jar=appName=grayscale-rocketmq-producer -Dserver.port=9040 -jar \
sermant-integration-tests/mq-grayscale-rocketmq-test/grayscale-rocketmq-producer-demo/target/grayscale-rocketmq-producer-demo.jar > ${{ env.logDir }}/rocketmq-producer-gray.log 2>&1 &
- name: start base consumer service
shell: bash
env:
dynamic.config.dynamicConfigType: KIE
dynamic.config.serverAddress: 127.0.0.1:30110
SERVICE_META_ENVIRONMENT: development
run: |
nohup java -javaagent:sermant-agent-${{ env.sermantVersion }}/agent/sermant-agent.jar=appName=grayscale-rocketmq-consumer -jar \
sermant-integration-tests/mq-grayscale-rocketmq-test/grayscale-rocketmq-consumer-demo/target/grayscale-rocketmq-consumer-demo.jar > ${{ env.logDir }}/rocketmq-consumer-base.log 2>&1 &
- name: start gray consumer service
shell: bash
if: matrix.test-model != 'CONSUMER_BASE_ONLY_PULL' && matrix.test-model != 'CONSUMER_BASE_ONLY_LITE_PULL' && matrix.test-model != 'CONSUMER_BASE_ONLY_PUSH'
env:
dynamic.config.dynamicConfigType: KIE
dynamic.config.serverAddress: 127.0.0.1:30110
SERVICE_META_ENVIRONMENT: development
SERVICE_META_VERSION: 1.0.1
run: |
nohup java -javaagent:sermant-agent-${{ env.sermantVersion }}/agent/sermant-agent.jar=appName=grayscale-rocketmq-consumer -Dserver.port=9010 -jar \
sermant-integration-tests/mq-grayscale-rocketmq-test/grayscale-rocketmq-consumer-demo/target/grayscale-rocketmq-consumer-demo.jar > ${{ env.logDir }}/rocketmq-consumer-gray.log 2>&1 &
- name: waiting for service start for only base
shell: bash
if: matrix.test-model == 'CONSUMER_BASE_ONLY_PULL' || matrix.test-model == 'CONSUMER_BASE_ONLY_LITE_PULL' || matrix.test-model == 'CONSUMER_BASE_ONLY_PUSH'
run: |
bash ./sermant-integration-tests/scripts/checkService.sh http://127.0.0.1:9030/actuator/health 200
bash ./sermant-integration-tests/scripts/checkService.sh http://127.0.0.1:9040/actuator/health 200
bash ./sermant-integration-tests/scripts/checkService.sh http://127.0.0.1:9000/actuator/health 200
- name: waiting for service start for base and gray
shell: bash
if: matrix.test-model != 'CONSUMER_BASE_ONLY_PULL' && matrix.test-model != 'CONSUMER_BASE_ONLY_LITE_PULL' && matrix.test-model != 'CONSUMER_BASE_ONLY_PUSH'
run: |
bash ./sermant-integration-tests/scripts/checkService.sh http://127.0.0.1:9030/actuator/health 200
bash ./sermant-integration-tests/scripts/checkService.sh http://127.0.0.1:9040/actuator/health 200
bash ./sermant-integration-tests/scripts/checkService.sh http://127.0.0.1:9000/actuator/health 200
bash ./sermant-integration-tests/scripts/checkService.sh http://127.0.0.1:9010/actuator/health 200
- name: test message grayscale rocketmq
shell: bash
run: |
mvn test -Dgrayscale.rocketmq.integration.test.type=${{ matrix.test-model }} -Dtest.version=${{ matrix.rocketMqClientVersion }} --file \
sermant-integration-tests/mq-grayscale-rocketmq-test/grayscale-rocketmq-integration-test/pom.xml
- name: exit
if: always()
uses: ./.github/actions/common/exit
with:
processor-keyword: grayscale-rocketmq
- name: if failure then upload error log
uses: actions/upload-artifact@v3
if: ${{ failure() || cancelled() }}
with:
name: (test-for-grayscale-rocketmq)-(${{ matrix.test-model }}})-logs
path: |
./*.log
./logs/**/*.log
if-no-files-found: warn
retention-days: 2
133 changes: 133 additions & 0 deletions .github/workflows/message_gray_integration_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: Message gray integration test
env:
sermantVersion: 1.0.0
on:
push:
pull_request:
branches:
- '*'
paths:
- 'sermant-agentcore/**'
- 'sermant-integration-tests/mq-grayscale-rocketmq-test/**'
- 'sermant-plugins/sermant-mq-grayscale/**'
- '.github/workflows/message_gray_integration_test.yml'
- '.github/actions/common/mq-grayscale/rocketmq/**'
- '.github/actions/scenarios/mq-grayscale/rocketmq/**'
- '.github/actions/common/plugin-change-check/action.yml'
- '.github/actions/common/entry/action.yml'
- '.github/actions/common/exit/action.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.head_ref }}
cancel-in-progress: true
jobs:
set-execution-conditions:
name: set-execution-conditions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 100
- name: plugin-change-check
id: plugin-change-check
uses: ./.github/actions/common/plugin-change-check
- name: set-outputs
id: set-outputs
run: |
echo "enableMqGrayscaleRocketMqAction=${{env.enableMqGrayscaleRocketMqAction}}" >> $GITHUB_OUTPUT
outputs:
enableMqGrayscaleRocketMqAction: ${{ steps.set-outputs.outputs.enableMqGrayscaleRocketMqAction }}
download-midwares-and-cache:
name: download midwares and cache
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: cache local cse
uses: actions/cache@v3
with:
path: Local-CSE-2.1.3-linux-amd64.zip
key: ${{ runner.os }}-local-cse
restore-keys: |
${{ runner.os }}-local-cse
- name: download cse
run: |
export ROOT_PATH=$(pwd)
bash ./sermant-integration-tests/scripts/tryDownloadMidware.sh cse
- name: cache rocketmq
uses: actions/cache@v3
with:
path: rocketmq-all-4.8.0-bin-release.zip
key: ${{ runner.os }}-rocketmq-all-4.8.0-bin-release
restore-keys: |
${{ runner.os }}-rocketmq-all-4.8.0-bin-release
- name: download rocketmq
run: |
export ROOT_PATH=$(pwd)
bash ./sermant-integration-tests/scripts/tryDownloadMidware.sh rocketmq
- name: cache rocketmq514
uses: actions/cache@v3
with:
path: rocketmq-all-5.1.4-bin-release.zip
key: ${{ runner.os }}-rocketmq-all-5.1.4-bin-release
restore-keys: |
${{ runner.os }}-rocketmq-all-5.1.4-bin-release
- name: download rocketmq
run: |
export ROOT_PATH=$(pwd)
bash ./sermant-integration-tests/scripts/tryDownloadMidware.sh rocketmq514
build-agent-and-cache:
name: build agent and cache
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'adopt'
cache: maven
- name: cache agent
uses: actions/cache@v3
with:
path: sermant-agent-*/
key: ${{ runner.os }}-agent-${{ github.run_id }}
- name: package agent
run: |
sed -i '/sermant-backend/d' pom.xml
sed -i '/sermant-integration-tests/d' pom.xml
sed -i '/sermant-injector/d' pom.xml
sed -i '/sermant-flowcontrol/d' sermant-plugins/pom.xml
sed -i '/sermant-database-write-prohibition/d' sermant-plugins/pom.xml
sed -i '/sermant-spring-beans-deal/d' sermant-plugins/pom.xml
sed -i '/sermant-service-removal/d' sermant-plugins/pom.xml
sed -i '/sermant-service-visibility/d' sermant-plugins/pom.xml
sed -i '/sermant-monitor/d' sermant-plugins/pom.xml
sed -i '/sermant-mq-consume-prohibition/d' sermant-plugins/pom.xml
sed -i '/sermant-springboot-registry/d' sermant-plugins/pom.xml
sed -i '/sermant-service-registry/d' sermant-plugins/pom.xml
sed -i '/sermant-dynamic-config/d' sermant-plugins/pom.xml
sed -i '/sermant-router/d' sermant-plugins/pom.xml
sed -i '/sermant-loadbalancer/d' sermant-plugins/pom.xml
mvn package -DskipTests -Ptest --file pom.xml
test-for-grayscale-rocketmq:
name: Test for grayscale rocketmq
runs-on: ubuntu-latest
if: needs.set-execution-conditions.outputs.enableMqGrayscaleRocketMqAction=='true'
needs: [set-execution-conditions, build-agent-and-cache, download-midwares-and-cache]
strategy:
matrix:
test-model: [ 'PLUGIN_ENABLED_FALSE_PULL','PLUGIN_ENABLED_FALSE_LITE_PULL','PLUGIN_ENABLED_FALSE_PUSH',
'CONSUMER_BASE_ONLY_PULL','CONSUMER_BASE_ONLY_LITE_PULL','CONSUMER_BASE_ONLY_PUSH',
'CONSUMER_BASE_GRAY_PULL','CONSUMER_BASE_GRAY_LITE_PULL','CONSUMER_BASE_GRAY_PUSH' ]
rocketMqClientVersion: ["4.8.0", "4.9.0", "4.9.1", "4.9.2", "4.9.3", "4.9.4", "4.9.5", "4.9.6", "4.9.7", "4.9.8", "5.0.0"]
fail-fast: false
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 100
- name: set java version to environment
run: |
echo "javaVersion=8" >> $GITHUB_ENV
- name: common operations
uses: ./.github/actions/common/mq-grayscale/rocketmq
- name: message gray test for test-model=${{ matrix.test-model }} rocketMqClientVersion=${{ matrix.rocketMqClientVersion }}
uses: ./.github/actions/scenarios/mq-grayscale/rocketmq
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>mq-grayscale-rocketmq-test</artifactId>
<groupId>io.sermant.integration</groupId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>grayscale-rocketmq-consumer-demo</artifactId>
<version>1.0.0</version>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-client</artifactId>
</dependency>
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-common</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
</dependencies>

<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

</project>
Loading

0 comments on commit 922ad63

Please sign in to comment.