Skip to content

Commit

Permalink
Merge pull request #1196 from xuezechao1/issue_1099_7
Browse files Browse the repository at this point in the history
事件上报集成测试用例
  • Loading branch information
Sherlockhan authored Jun 30, 2023
2 parents dc24ef2 + 20ed21c commit 3e4f10e
Show file tree
Hide file tree
Showing 4 changed files with 413 additions and 0 deletions.
82 changes: 82 additions & 0 deletions .github/actions/scenarios/backend/memory/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: "Backend Test Use Memory"
description: "Auto test for Backend"
runs:
using: "composite"
steps:
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: '8'
distribution: 'adopt'
cache: maven
- name: Set up python
uses: actions/setup-python@v3.1.3
with:
python-version: '3.10'
- name: download middlewares
uses: actions/cache@v3
with:
path: |
apache-zookeeper-*/
key: ${{ runner.os }}-middlewares-${{ github.run_id }}
- name: start zookeeper
shell: bash
run: bash apache-zookeeper-3.6.3-bin/bin/zkServer.sh start apache-zookeeper-3.6.3-bin/conf/zoo_sample.cfg
- name: download agent
uses: actions/cache@v3
with:
path: sermant-agent-*/
key: ${{ runner.os }}-agent-${{ github.run_id }}
- name: package dubbo 2.6.0 tests
shell: bash
run: mvn package -Dalibaba.dubbo.version=2.6.0 -DskipTests -P260 --file sermant-integration-tests/dubbo-test/pom.xml
- name: entry
uses: ./.github/actions/common/entry
with:
log-dir: ./logs/backend
- name: start backend with memory
shell: bash
run: |
nohup java -jar sermant-agent-${{ env.sermantVersion }}/server/sermant/sermant-backend-${{ env.sermantVersion }}.jar &
- name: start demo
shell: bash
env:
AGENT_CONFIG_ISOUTPUTENHANCEDCLASSES: "true"
AGENT_CONFIG_ISSHOWENHANCELOG: "true"
AGENT_SERVICE_HEARTBEAT_ENABLE: "true"
AGENT_SERVICE_GATEWAY_ENABLE: "true"
EVENT_ENABLE: "true"
EVENT_OFFERWARNLOG: "true"
run: |
nohup java -javaagent:sermant-agent-${{ env.sermantVersion }}/agent/sermant-agent.jar=appName=backend-demo -jar sermant-integration-tests/dubbo-test/dubbo-2-6-integration-provider/target/dubbo-integration-provider.jar &
- name: waiting for demo start
shell: bash
run: |
bash ./sermant-integration-tests/scripts/checkService.sh http://127.0.0.1:28021/actuator/health 120
bash ./sermant-integration-tests/scripts/checkService.sh http://127.0.0.1:8900/sermant/event/webhooks 120
- name: stop demo
shell: bash
run: |
netstat -nlp | grep :28021 | awk '{print $7}' | awk -F "/" '{print $1}' | xargs kill
- name: install requests
shell: bash
run: |
pip install requests
- name: start test
shell: bash
run: |
python -m unittest ./sermant-integration-tests/scripts/testBackend.py
- name: stop backend
shell: bash
run: |
netstat -nlp | grep :8900 | awk '{print $7}' | awk -F "/" '{print $1}' | xargs kill
- name: if failure then upload error log
uses: actions/upload-artifact@v3
if: ${{ failure() || cancelled() }}
with:
name: (${{ github.job }})-backend-logs
path: |
./*.log
./logs/**
if-no-files-found: warn
retention-days: 2
58 changes: 58 additions & 0 deletions .github/actions/scenarios/backend/redis/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: "Backend Test Use Redis"
description: "Auto test for Backend"
runs:
using: "composite"
steps:
- name: entry
uses: ./.github/actions/common/entry
with:
log-dir: ./logs/backend
- name: install redis
shell: bash
run: |
sudo apt install redis-server -y
sudo sed -i 's/# requirepass foobared/requirepass 123456/g' /etc/redis/redis.conf
sudo service redis restart
- name: start backend with redis
shell: bash
env:
DATABASE_TYPE: REDIS
DATABASE_VERSION: "6.0"
DATABASE_PASSWORD: "123456"
run: |
nohup java -jar sermant-agent-${{ env.sermantVersion }}/server/sermant/sermant-backend-${{ env.sermantVersion }}.jar &
- name: start demo
shell: bash
env:
AGENT_CONFIG_ISOUTPUTENHANCEDCLASSES: "true"
AGENT_CONFIG_ISSHOWENHANCELOG: "true"
AGENT_SERVICE_HEARTBEAT_ENABLE: "true"
AGENT_SERVICE_GATEWAY_ENABLE: "true"
EVENT_ENABLE: "true"
EVENT_OFFERWARNLOG: "true"
EVENT_OFFERERRORLOG: "true"
run: |
nohup java -javaagent:sermant-agent-${{ env.sermantVersion }}/agent/sermant-agent.jar=appName=backend-demo -jar sermant-integration-tests/dubbo-test/dubbo-2-6-integration-provider/target/dubbo-integration-provider.jar &
- name: waiting for demo start
shell: bash
run: |
bash ./sermant-integration-tests/scripts/checkService.sh http://127.0.0.1:28021/actuator/health 120
bash ./sermant-integration-tests/scripts/checkService.sh http://127.0.0.1:8900/sermant/event/webhooks 120
- name: stop demo
shell: bash
run: |
netstat -nlp | grep :28021 | awk '{print $7}' | awk -F "/" '{print $1}' | xargs kill
- name: start test
shell: bash
run: |
python -m unittest ./sermant-integration-tests/scripts/testBackend.py
- name: if failure then upload error log
uses: actions/upload-artifact@v3
if: ${{ failure() || cancelled() }}
with:
name: (${{ github.job }})-backend-logs
path: |
./*.log
./logs/**
if-no-files-found: warn
retention-days: 2
66 changes: 66 additions & 0 deletions .github/workflows/backend_integration_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Backend Integration Test
env:
sermantVersion: 1.0.0
on:
push:
pull_request:
branches:
- '*'
paths:
- 'sermant-agentcore/**'
- 'sermant-backend/**'
- '.github/workflows/backend*.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.head_ref }}
cancel-in-progress: true
jobs:
download-midwares-and-cache:
name: download midwares and cache
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: cache middlewares
uses: actions/cache@v3
with:
path: |
apache-zookeeper-*/
key: ${{ runner.os }}-middlewares-${{ github.run_id }}
- name: download middlewares
run: |
export ROOT_PATH=$(pwd)
bash ./sermant-integration-tests/scripts/tryDownloadMidware.sh zk
tar -zxf apache-zookeeper-3.6.3-bin.tar.gz
build-agent-and-cache:
name: build agent and cache
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
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-lite/d' pom.xml
sed -i '/sermant-integration-tests/d' pom.xml
sed -i '/sermant-injector/d' pom.xml
mvn package -DskipTests -Ptest --file pom.xml
test-for-backend:
name: Test for backend
runs-on: ubuntu-latest
needs: [ build-agent-and-cache, download-midwares-and-cache ]
steps:
- uses: actions/checkout@v2
- name: start backend use memory test
uses: ./.github/actions/scenarios/backend/memory
- name: start backend use redis test
uses: ./.github/actions/scenarios/backend/redis


Loading

0 comments on commit 3e4f10e

Please sign in to comment.