add java test case for oblogproxy-ce #7
Workflow file for this run
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
name: test oblogproxy-ce | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
paths: | |
- '.github/workflows/**-oblogproxy-ce.yml' | |
- '.github/workflows/**-oceanbase-ce.yml' | |
- 'oblogproxy-ce/**' | |
- 'oceanbase-ce/**' | |
- 'test/**' | |
concurrency: | |
group: test-oblogproxy-ce-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-oceanbase-ce: | |
uses: ./.github/workflows/build-oceanbase-ce.yml | |
with: | |
cache_key: test-oblogproxy-ce_oceanbase-ce | |
image_file: oceanbase-ce.tar | |
version: 4.2.1.6-106000012024042515 | |
build-oblogproxy-ce: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Print environment variables | |
run: printenv | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build oblogproxy-ce image | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./oblogproxy-ce | |
platforms: linux/amd64 | |
file: ./oblogproxy-ce/Dockerfile | |
push: false | |
load: true | |
tags: oblogproxy-ce | |
build-args: | | |
VERSION=2.0.2-100000012024060321 | |
- name: Export Docker image | |
run: docker save -o oblogproxy-ce.tar oblogproxy-ce | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-oblogproxy-ce_oblogproxy-ce | |
path: oblogproxy-ce.tar | |
test-oblogproxy-ce: | |
runs-on: ubuntu-latest | |
needs: [ build-oceanbase-ce, build-oblogproxy-ce ] | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: test-oblogproxy-ce_** | |
path: /tmp | |
- name: Load Docker image | |
run: | | |
docker load -i /tmp/test-oblogproxy-ce_oceanbase-ce/oceanbase-ce.tar | |
docker load -i /tmp/test-oblogproxy-ce_oblogproxy-ce/oblogproxy-ce.tar | |
sudo rm -rf /tmp/* | |
- name: Start oceanbase-ce container | |
uses: oceanbase/setup-oceanbase-ce@v1 | |
with: | |
image_name: oceanbase-ce | |
container_name: oceanbase-ce | |
sql_port: 12881 | |
rpc_port: 12882 | |
mode: mini | |
sys_root_password: 123456 | |
tenant_root_password: 654321 | |
- name: Start oblogproxy-ce container | |
run: docker run --name oblogproxy-ce -e OB_SYS_USERNAME=root -e OB_SYS_PASSWORD=123456 -p 12983:2983 -d oblogproxy-ce | |
- name: Set container IP | |
id: set_container_ip | |
run: | | |
observer_ip=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' oceanbase-ce) | |
oblogproxy_ip=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' oblogproxy-ce) | |
echo "Container 'oceanbase-ce' IP is $observer_ip." | |
echo "Container 'oblogproxy-ce' IP is $oblogproxy_ip." | |
echo "observer_ip=$observer_ip" >> $GITHUB_OUTPUT | |
echo "oblogproxy_ip=$oblogproxy_ip" >> $GITHUB_OUTPUT | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up Java | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '8' | |
distribution: 'zulu' | |
- name: Build test project | |
run: | | |
cd test | |
mvn install -DskipTests=true | |
- name: Run test methods | |
env: | |
observer_ip: ${{ steps.set_container_ip.outputs.observer_ip }} | |
oblogproxy_ip: ${{ steps.set_container_ip.outputs.oblogproxy_ip }} | |
oblogproxy_port: 12983 | |
username: root@test | |
password: 654321 | |
run: | | |
cd test | |
mvn verify -Dtest=LogProxyCETest -DfailIfNoTests=false |