-
Notifications
You must be signed in to change notification settings - Fork 7
131 lines (109 loc) · 3.92 KB
/
test-oblogproxy-ce.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: test oblogproxy-ce
on:
pull_request:
paths:
- '.github/workflows/**-oblogproxy-ce.yml'
- '.github/workflows/build-oceanbase-ce.yml'
- 'oblogproxy-ce/Dockerfile'
- 'oblogproxy-ce/**.sh'
- 'oceanbase-ce/Dockerfile'
- 'oceanbase-ce/**.sh'
- 'oceanbase-ce/**.yaml'
- 'test/**/LogProxyCETest.java'
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.8-108000022024072217
build-oblogproxy-ce:
runs-on: ubuntu-latest
steps:
- name: Clean tool cache
run: sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- 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
- 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: Clean tool cache
run: sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- 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