-
Notifications
You must be signed in to change notification settings - Fork 417
324 lines (307 loc) · 14 KB
/
run_fvt_tests.yaml
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
name: Run fvt tests
concurrency:
group: fvt-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_call:
env:
DEBIAN_FRONTEND: noninteractive
jobs:
fvt_tests_with_edgex:
runs-on: ubuntu-latest
# Service containers to run with `runner-job`
services:
# Label used to access the service container
redis:
# Docker Hub image
image: redis
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps port 6379 on service container to the host
- 6379:6379
emqx:
image: emqx/emqx:4.3.10
ports:
- 1883:1883
- 18083:18083
steps:
- uses: actions/setup-go@v5
with:
go-version: '1.22'
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: '8' # The JDK version to make available on the path.
java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk
architecture: x64 # (x64 or x86) - defaults to x64
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pynng==0.7.2
- name: install jmeter
timeout-minutes: 10
env:
JMETER_VERSION: 5.4.3
run: |
wget --no-check-certificate -O /tmp/apache-jmeter.tgz https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-$JMETER_VERSION.tgz
cd /tmp && tar -xvf apache-jmeter.tgz
echo "jmeter.save.saveservice.output_format=xml" >> /tmp/apache-jmeter-$JMETER_VERSION/user.properties
echo "jmeter.save.saveservice.response_data.on_error=true" >> /tmp/apache-jmeter-$JMETER_VERSION/user.properties
wget -O /tmp/apache-jmeter-$JMETER_VERSION/lib/ext/mqtt-xmeter-1.13-jar-with-dependencies.jar https://github.com/emqx/mqtt-jmeter/raw/master/Download/v1.13.0/mqtt-xmeter-1.13-jar-with-dependencies.jar
ln -s /tmp/apache-jmeter-$JMETER_VERSION /opt/jmeter
- name: install tdengine client
timeout-minutes: 10
env:
TD_VERSION: 2.4.0.18
run: |
if [ "$(uname -m)" = "x86_64" ]; then
wget "https://www.taosdata.com/assets-download/TDengine-client-$TD_VERSION-Linux-x64.tar.gz" -O /tmp/TDengine-client-2.4.0.18.tar.gz;
fi;
if [ "$(uname -m)" = "aarch64" ]; then
wget "https://www.taosdata.com/assets-download/TDengine-client-$TD_VERSION-Linux-aarch64.tar.gz" -O /tmp/TDengine-client-2.4.0.18.tar.gz;
fi;
tar -zxvf /tmp/TDengine-client-$TD_VERSION.tar.gz
cd TDengine-client-$TD_VERSION && ./install_client.sh
- uses: actions/checkout@v4
- name: build kuiper
run: |
sudo apt-get update && sudo apt-get install pkg-config libczmq-dev -y
make build_with_cover
echo "KUIPER_LOG_PATH=_build/kuiper-$(git describe --tags --always --match 'v[0-9]*.[0-9]*.[0-9]*' | sed 's/^v//g')-$(uname -s | tr "[A-Z]" "[a-z]")-amd64/log" >> $GITHUB_ENV
- name: run edgex && kuiper
run: |
./test/setup_env.sh
./test/prepare_plugins.sh
- name: run fvt tests
timeout-minutes: 12
run: ./test/run_jmeter.sh with_edgex=true
- uses: actions/upload-artifact@v4
if: always()
with:
name: kuiper_logs_with_edgex
path: ${{ env.KUIPER_LOG_PATH }}
- uses: actions/upload-artifact@v4
if: always()
with:
name: jmeter_logs_with_edgex
path: ./jmeter_logs
- name: check logs
run: |
sudo apt-get update && sudo apt-get install -y libxml2-utils
cd jmeter_logs
for file in `ls *.jtl`
do
if [ ! -z "$(cat $file| grep '<failure>' | awk -F '>' '{print $2}' | awk -F '<' '{print $1}' | grep true)" ] ||
[ "$(xmllint --format --xpath '/testResults/sample/@rc' $file | sed -r 's/ /\n/g;' | sort -u | grep -E 'rc=\"[45][0-9][0-9]\"|rc=\"\"')" != "" ]; then
echo -e "---------------------------------------------\n"
echo "FVT tests error for $file"
exit 1
fi
done
- name: make clean.sh executable
run: chmod +x ./test/clean.sh
- name: stop kuiper
run: ./test/clean.sh
- name: gen codecov
run: |
go tool covdata textfmt -i=cover -o=jmeter.xml
- name: upload coverage report for jmeter
uses: actions/upload-artifact@v4
with:
name: jmeter_coverage
path: jmeter.xml
fvt_tests_redis_as_storage:
runs-on: ubuntu-latest
# Service containers to run with `runner-job`
services:
# Label used to access the service container
redis:
# Docker Hub image
image: redis
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps port 6379 on service container to the host
- 6379:6379
emqx:
image: emqx/emqx:4.3.10
ports:
- 1883:1883
- 18083:18083
steps:
- uses: actions/setup-go@v5
with:
go-version: '1.22'
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: '8' # The JDK version to make available on the path.
java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk
architecture: x64 # (x64 or x86) - defaults to x64
- name: install jmeter
timeout-minutes: 10
env:
JMETER_VERSION: 5.4.3
run: |
wget --no-check-certificate -O /tmp/apache-jmeter.tgz https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-$JMETER_VERSION.tgz
cd /tmp && tar -xvf apache-jmeter.tgz
echo "jmeter.save.saveservice.output_format=xml" >> /tmp/apache-jmeter-$JMETER_VERSION/user.properties
echo "jmeter.save.saveservice.response_data.on_error=true" >> /tmp/apache-jmeter-$JMETER_VERSION/user.properties
wget -O /tmp/apache-jmeter-$JMETER_VERSION/lib/ext/mqtt-xmeter-1.13-jar-with-dependencies.jar https://github.com/emqx/mqtt-jmeter/raw/master/Download/v1.13.0/mqtt-xmeter-1.13-jar-with-dependencies.jar
ln -s /tmp/apache-jmeter-$JMETER_VERSION /opt/jmeter
- uses: actions/checkout@v4
- name: build kuiper
run: |
make build_with_cover
echo "KUIPER_LOG_PATH=_build/kuiper-$(git describe --tags --always --match 'v[0-9]*.[0-9]*.[0-9]*' | sed 's/^v//g')-$(uname -s | tr "[A-Z]" "[a-z]")-amd64/log" >> $GITHUB_ENV
- name: run edgex && kuiper
env:
KUIPER__STORE__TYPE: redis
KUIPER__STORE__REDIS__PASSWORD: ""
run: ./test/setup_env.sh
- name: run fvt tests
timeout-minutes: 8
run: |
rm -rf test/redis/set
go build -o test/redis/set test/redis/set.go
chmod +x test/redis/set
fvt_dir=`pwd`
/opt/jmeter/bin/jmeter.sh -Jjmeter.save.saveservice.output_format=xml -n -t test/redis_kv_storage.jmx -Dfvt="$fvt_dir" -l jmeter_logs/redis_kv_storage.jtl -j jmeter_logs/redis_kv_storage.log
- uses: actions/upload-artifact@v4
if: always()
with:
name: kuiper_logs_redis_storage
path: ${{ env.KUIPER_LOG_PATH }}
- uses: actions/upload-artifact@v4
if: always()
with:
name: jmeter_logs_redis_storage
path: ./jmeter_logs
- name: check logs
run: |
sudo apt-get update && sudo apt-get install -y libxml2-utils
cd jmeter_logs
for file in `ls *.jtl`
do
if [ ! -z "$(cat $file| grep '<failure>' | awk -F '>' '{print $2}' | awk -F '<' '{print $1}' | grep true)" ] ||
[ "$(xmllint --format --xpath '/testResults/sample/@rc' $file | sed -r 's/ /\n/g;' | sort -u | grep -E 'rc=\"[45][0-9][0-9]\"|rc=\"\"')" != "" ]; then
echo -e "---------------------------------------------\n"
echo "FVT tests error for $file"
exit 1
fi
done
- name: make clean.sh executable
run: chmod +x ./test/clean.sh
- name: stop kuiper
run: ./test/clean.sh
- name: gen codecov
run: |
go tool covdata textfmt -i=cover -o=jmeter_redis.xml
- name: upload coverage report for jmeter redis
uses: actions/upload-artifact@v4
with:
name: jmeter_redis_coverage
path: jmeter_redis.xml
fvt_tests_for_container_in_helm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: '8' # The JDK version to make available on the path.
java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk
architecture: x64 # (x64 or x86) - defaults to x64
- name: install jmeter
timeout-minutes: 10
env:
JMETER_VERSION: 5.4.3
run: |
wget --no-check-certificate -O /tmp/apache-jmeter.tgz https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-$JMETER_VERSION.tgz
cd /tmp && tar -xvf apache-jmeter.tgz
echo "jmeter.save.saveservice.output_format=xml" >> /tmp/apache-jmeter-$JMETER_VERSION/user.properties
echo "jmeter.save.saveservice.response_data.on_error=true" >> /tmp/apache-jmeter-$JMETER_VERSION/user.properties
wget -O /tmp/apache-jmeter-$JMETER_VERSION/lib/ext/mqtt-xmeter-1.13-jar-with-dependencies.jar https://github.com/emqx/mqtt-jmeter/raw/master/Download/v1.13.0/mqtt-xmeter-1.13-jar-with-dependencies.jar
ln -s /tmp/apache-jmeter-$JMETER_VERSION /opt/jmeter
- name: setup jmeter
timeout-minutes: 10
run: |
wget -O "/opt/jmeter/lib/json-lib-2.4-jdk15.jar" https://repo1.maven.org/maven2/net/sf/json-lib/json-lib/2.4/json-lib-2.4-jdk15.jar
wget -O "/opt/jmeter/lib/commons-beanutils-1.8.0.jar" https://repo1.maven.org/maven2/commons-beanutils/commons-beanutils/1.8.0/commons-beanutils-1.8.0.jar
wget -O "/opt/jmeter/lib/commons-collections-3.2.1.jar" https://repo1.maven.org/maven2/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar
wget -O "/opt/jmeter/lib/commons-lang-2.5.jar" https://repo1.maven.org/maven2/commons-lang/commons-lang/2.5/commons-lang-2.5.jar
wget -O "/opt/jmeter/lib/commons-logging-1.1.1.jar" https://repo1.maven.org/maven2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar
wget -O "/opt/jmeter/lib/ezmorph-1.0.6.jar" https://repo1.maven.org/maven2/net/sf/ezmorph/ezmorph/1.0.6/ezmorph-1.0.6.jar
- name: install docker
run: |
sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
- name: install k3s
env:
KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
run: |
sudo sh -c "echo \"127.0.0.1 $(hostname)\" >> /etc/hosts"
curl -sfL https://get.k3s.io | sh -
sudo chmod 644 /etc/rancher/k3s/k3s.yaml
kubectl cluster-info
- name: install helm
run: |
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
sudo chmod 700 get_helm.sh
sudo ./get_helm.sh
helm version
- name: build kuiper for docker
run: sudo docker build --no-cache -t lfedge/ekuiper:$(git describe --tags --always --match 'v[0-9]*.[0-9]*.[0-9]*' | sed 's/^v//g') -f deploy/docker/Dockerfile .
- name: run emqx on chart
env:
KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
timeout-minutes: 5
run: |
helm repo add emqx https://repos.emqx.io/charts
helm repo update
helm install emqx --set replicaCount=1 emqx/emqx
while [ "$(kubectl get StatefulSet -l app.kubernetes.io/name=emqx -o jsonpath='{.items[0].status.replicas}')" \
!= "$(kubectl get StatefulSet -l app.kubernetes.io/name=emqx -o jsonpath='{.items[0].status.readyReplicas}')" ]; do
echo "waiting emqx started"
sleep 10
done
- name: run kuiper for chart
env:
KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
timeout-minutes: 5
run: |
version=$(git describe --tags --always --match 'v[0-9]*.[0-9]*.[0-9]*' | sed 's/^v//g')
emqx_address=$(kubectl get svc --namespace default emqx -o jsonpath="{.spec.clusterIP}")
sudo docker save lfedge/ekuiper:$version -o kuier.tar.gz
sudo k3s ctr image import kuier.tar.gz
sed -i -r "s/^appVersion: .*$/appVersion: \"${version}\"/g" deploy/chart/ekuiper/Chart.yaml
sed -i -r 's/ pullPolicy: .*$/ pullPolicy: Never/g' deploy/chart/ekuiper/values.yaml
helm install ekuiper deploy/chart/ekuiper --debug --dry-run
helm install ekuiper deploy/chart/ekuiper
while [ "$(kubectl get pods -l app.kubernetes.io/name=ekuiper -o json | jq '.items[0].status.containerStatuses[] | select(.ready==true) | .containerID')" = "" ]; do
echo "=============================="
kubectl get pods
echo "=============================="
echo "waiting ekuiper started"
sleep 10
done
ekuiper_address=$(kubectl get svc --namespace default ekuiper -o jsonpath="{.spec.clusterIP}")
if [ $(curl -w %{http_code} -fsSL -o /dev/null $ekuiper_address:9081) != 200 ];then
ekuiper_pod=$(kubectl get pod -l app.kubernetes.io/instance=ekuiper -o jsonpath="{.items[0].metadata.name}")
kubectl logs $ekuiper_pod
exit 1;
fi