-
Notifications
You must be signed in to change notification settings - Fork 452
164 lines (148 loc) · 5.96 KB
/
run_test_case.yaml
File metadata and controls
164 lines (148 loc) · 5.96 KB
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
name: Run test cases
concurrency:
group: test-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
tags:
- "*"
branches:
- master
pull_request:
paths-ignore:
- "docs/**"
release:
types:
- published
permissions:
contents: read
jobs:
run_unit_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.25.4'
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: |
pip3 install pynng==0.8.1 && sudo apt-get update && sudo apt-get install ffmpeg libzmq3-dev -y
- name: make install.sh executable
run: chmod +x ./extensions/functions/onnx/install.sh
- name: Build plugins
run: |
set -e -u -x
mkdir -p data
mkdir -p log
mkdir -p plugins/sinks plugins/sources plugins/functions
sed -i -r "s/debug: .*/debug: true/1" etc/kuiper.yaml
go build --buildmode=plugin -trimpath --cover -covermode=atomic -coverpkg=./... -o plugins/sources/[email protected] extensions/sources/random/random.go
cp extensions/sources/random/random.yaml etc/sources/random.yaml
go build --buildmode=plugin -trimpath --cover -covermode=atomic -coverpkg=./... -o plugins/functions/Echo.so extensions/functions/echo/echo.go
go build --buildmode=plugin -trimpath --cover -covermode=atomic -coverpkg=./... -o plugins/functions/[email protected] extensions/functions/countPlusOne/countPlusOne.go
go build --buildmode=plugin -trimpath --cover -covermode=atomic -coverpkg=./... -o plugins/functions/[email protected] extensions/functions/accumulateWordCount/accumulateWordCount.go
mkdir -p plugins/portable/mirror
cd sdk/go/example/mirror
go build -o ../../../../plugins/portable/mirror/mirror .
cp mirror.json ../../../../plugins/portable/mirror
cd ../../../../
cp -r sdk/python/ekuiper sdk/python/example/pysam/
cp test/lookup.json data/lookup.json
cd extensions/functions/onnx
sudo ./install.sh
- name: Install Merge Tool
run: go install github.com/wadey/gocovmerge@latest
- name: Run test case
run: |
make failpoint-enable
# 1. Run MAIN tests (With Race)
# We ADD -skip to avoid running the special tests here
go test -trimpath -race -tags="edgex msgpack script parquet test rpc" \
-skip "TestMsgpackService|TestExtensions|TestFuncState|TestFuncStateCheckpoint|TestStartCPUProfiling" \
-cover -covermode=atomic -coverpkg=./... -coverprofile=cover_race.out \
$(go list ./... | grep -v "github.com/lf-edge/ekuiper/v2/fvt")
# 2. Run SPECIAL tests (No Race)
go test -trimpath -tags="edgex msgpack script parquet test rpc" \
-run "TestMsgpackService|TestExtensions|TestFuncState|TestFuncStateCheckpoint|TestStartCPUProfiling" \
-cover -covermode=atomic -coverpkg=./... -coverprofile=cover_norace.out \
./internal/service ./internal/topo/exttest ./internal/server/proftest
# 3. Safe Merge using gocovmerge
# This correctly sums up the counters for shared code
$HOME/go/bin/gocovmerge cover_race.out cover_norace.out > coverage.xml
# 4. Calculate Total
total_coverage=$(go tool cover -func=coverage.xml 2>/dev/null | grep total | awk '{print $3}')
echo "Total coverage: $total_coverage"
# 5. Ensure failpoints disable even if tests fail
- name: Cleanup Failpoints
if: always() # Runs even if previous step failed
run: make failpoint-disable
- uses: actions/upload-artifact@v4
if: failure()
with:
name: stream.log
path: log/stream.log
- name: upload coverage report for ut
uses: actions/upload-artifact@v4
with:
name: coverage
path: coverage.xml
- name: Clean plugins
run: |
rm -r plugins/portable/mirror
- name: Run fvt
run: |
export KUIPER__BASIC__ALLOWEXTERNALFILEACCESS="true"
go test -trimpath -race -tags="full deadlock" --cover -covermode=atomic -coverpkg=./... -coverprofile=fvt_coverage.xml ./fvt
total_coverage=$(go tool cover -func=coverage.xml 2>/dev/null | grep total | awk '{print $3}')
echo "Total coverage: $total_coverage"
- uses: actions/upload-artifact@v4
if: failure()
with:
name: streamFvt.log
path: log/stream.log
- name: upload coverage report for fvt
uses: actions/upload-artifact@v4
with:
name: fvt_coverage
path: fvt_coverage.xml
run_fvt_tests:
uses: ./.github/workflows/run_fvt_tests.yaml
upload_coverage:
needs:
- run_unit_tests
- run_fvt_tests
runs-on: ubuntu-latest
steps:
- name: Download ut coverage reports
uses: actions/download-artifact@v4
with:
name: coverage
path: ./
- name: Download fvt coverage reports
uses: actions/download-artifact@v4
with:
name: fvt_coverage
path: ./
- name: Download jmeter coverage reports
uses: actions/download-artifact@v4
with:
name: jmeter_coverage
path: ./
- name: Download jmeter redis coverage reports
uses: actions/download-artifact@v4
with:
name: jmeter_redis_coverage
path: ./
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: coverage.xml,fvt_coverage.xml,jmeter.xml,jmeter_redis.xml
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
version: v10.2.1
verbose: true