-
Notifications
You must be signed in to change notification settings - Fork 0
317 lines (279 loc) · 8.97 KB
/
server-tests.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
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
name: Server Tests
on: [push]
jobs:
#=========================================================================
# Test Image:
#-------------------------------------------------------------------------
create_and_push_ci_image:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
defaults:
run:
shell: bash
env:
LD_LIBRARY_PATH: /usr/local/lib
IMAGE_NAME: "ghcr.io/${{ github.repository }}-ci:${{ github.ref_name }}"
steps:
- name: Checkout libyimmo
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
path: 'libyimmo'
- name: Log in to GHCR
run: |
echo ${{ secrets.GITHUB_TOKEN }} \
| docker login ghcr.io \
-u "${{ github.repository_owner }}" \
--password-stdin
- name: Pull test image, if available
continue-on-error: true
run: |
docker pull $IMAGE_NAME
working-directory: ./libyimmo
- name: Build Test Image
run: |
OCI_IMAGE_SOURCE="https://github.com/${{ github.repository }}" \
./ci/build-yimmo-test-image.sh
working-directory: ./libyimmo
- name: Push Test image
run: |
docker push $IMAGE_NAME
working-directory: ./libyimmo
#=========================================================================
# HTTP:
#-------------------------------------------------------------------------
run_http_tests:
runs-on: ubuntu-latest
needs: create_and_push_ci_image
permissions:
contents: read
packages: read
defaults:
run:
shell: bash
env:
LD_LIBRARY_PATH: /usr/local/lib
IMAGE_NAME: "ghcr.io/${{ github.repository }}-ci:${{ github.ref_name }}"
steps:
- name: Checkout libyimmo
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
path: 'libyimmo'
- name: Log in to GHCR
run: |
echo ${{ secrets.GITHUB_TOKEN }} \
| docker login ghcr.io \
-u "${{ github.repository_owner }}" \
--password-stdin
- name: Set up base system
run: |
sudo apt update
sudo apt-get -qq install -y \
apache2-utils
# Sorry. Very hacky:
sudo pip3 install -r ./ci/http/requirements.txt
working-directory: ./libyimmo
- name: Start HTTP Server
run: |
docker run \
--detach \
--name yimmo-wsgi-server \
-e YIMMO_LOG_LEVEL=WARNING \
-e YIMMO_WSGI_NO_PROC=2 \
-e YIMMO_WSGI_NO_THREADS=2 \
-p 8081:8081 \
$IMAGE_NAME
# HACK: wait for the server to come up:
# (Probably: use docker compose...)
./util/wait-for-svc.sh \
'127.0.0.1' 8081 'status' \
30 1
working-directory: ./libyimmo
- name: Run HTTP 1.0 Tests
run: |
# Run tests against the server:
./ci/http/test_http_1_0_basic.sh
working-directory: ./libyimmo
- name: Run HTTP 1.1 Tests
run: |
pytest -v --disable-warnings ./ci/http
working-directory: ./libyimmo
- name: Stop HTTP Server
run: |
# Shut down the test server:
docker stop yimmo-wsgi-server
docker rm yimmo-wsgi-server
working-directory: ./libyimmo
#=========================================================================
# WebSockets:
#-------------------------------------------------------------------------
run_ws_tests:
runs-on: ubuntu-latest
needs: create_and_push_ci_image
permissions:
contents: read
packages: read
defaults:
run:
shell: bash
env:
LD_LIBRARY_PATH: /usr/local/lib
IMAGE_NAME: "ghcr.io/${{ github.repository }}-ci:${{ github.ref_name }}"
steps:
- name: Checkout libyimmo
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
path: 'libyimmo'
- name: Log in to GHCR
run: |
echo ${{ secrets.GITHUB_TOKEN }} \
| docker login ghcr.io \
-u "${{ github.repository_owner }}" \
--password-stdin
- name: Set up base system
run: |
sudo apt update
sudo apt-get -qq install -y \
jq
working-directory: ./libyimmo
- name: Run Autobahn Test Suite
timeout-minutes: 5
#continue-on-error: true
run: |
mkdir -p ./reports
docker compose up --abort-on-container-exit
docker compose down
working-directory: ./libyimmo/ci/ws
- name: Autobahn Results
run: |
./autobahn-json-summary.sh ./reports/servers/index.json
working-directory: ./libyimmo/ci/ws
#=========================================================================
# K6 pseudo-load test:
#-------------------------------------------------------------------------
run_k6_tests:
runs-on: ubuntu-latest
needs: create_and_push_ci_image
permissions:
contents: read
packages: read
defaults:
run:
shell: bash
env:
LD_LIBRARY_PATH: /usr/local/lib
IMAGE_NAME: "ghcr.io/${{ github.repository }}-ci:${{ github.ref_name }}"
steps:
- name: Checkout libyimmo
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
path: 'libyimmo'
- name: Log in to GHCR
run: |
echo ${{ secrets.GITHUB_TOKEN }} \
| docker login ghcr.io \
-u "${{ github.repository_owner }}" \
--password-stdin
- name: Set up base system
run: |
sudo apt-key adv \
--keyserver hkp://keyserver.ubuntu.com:80 \
--recv-keys C5AD17C747E3415A3642D57D77C6C491D6AC1D69
echo "deb https://dl.k6.io/deb stable main" \
| sudo tee /etc/apt/sources.list.d/k6.list
sudo apt-get update
sudo apt-get install k6
working-directory: ./libyimmo
- name: Start WS Server
run: |
docker run \
--detach \
--name yimmo-ws-server \
--entrypoint /opt/build/yimmo/ci/ws/yimmo-ws-echo \
-e YIMMO_LOG_LEVEL=WARNING \
-p 8081:8081 \
$IMAGE_NAME
# HACK: wait for the server to come up:
./util/wait-for-svc.sh \
'127.0.0.1' 8081 'status' \
30 1
working-directory: ./libyimmo
- name: Run K6 Tests (experimental)
timeout-minutes: 3
continue-on-error: true
run: |
k6 run -q ./k6-ws-client.js
working-directory: ./libyimmo/ci/ws
- name: Stop WS Server
run: |
# Shut down the test server:
docker stop yimmo-ws-server
docker rm yimmo-ws-server
working-directory: ./libyimmo
#=========================================================================
# Apache Bench pseudo-load test:
#-------------------------------------------------------------------------
run_apache_bench_tests:
runs-on: ubuntu-latest
needs: create_and_push_ci_image
permissions:
contents: read
packages: read
defaults:
run:
shell: bash
env:
LD_LIBRARY_PATH: /usr/local/lib
IMAGE_NAME: "ghcr.io/${{ github.repository }}-ci:${{ github.ref_name }}"
steps:
- name: Checkout libyimmo
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
path: 'libyimmo'
- name: Log in to GHCR
run: |
echo ${{ secrets.GITHUB_TOKEN }} \
| docker login ghcr.io \
-u "${{ github.repository_owner }}" \
--password-stdin
- name: Set up base system
run: |
sudo apt update
sudo apt-get -qq install -y \
apache2-utils
sudo apt update
sudo snap install k6
working-directory: ./libyimmo
- name: Start HTTP Server
run: |
docker run \
--detach \
--name yimmo-http-server \
--entrypoint /opt/build/yimmo/examples/yimmo-example-http \
-e YIMMO_LOG_LEVEL=WARNING \
-p 8081:8081 \
$IMAGE_NAME
# HACK: wait for the server to come up:
./util/wait-for-svc.sh \
'127.0.0.1' 8081 'status' \
30 1
working-directory: ./libyimmo
- name: Run Apache Bench
run: |
# Hit it with some load (hacky / not a load test!):
YMO_NO_CLIENTS=5000 \
YMO_TEST_URL='http://127.0.0.1:8081/status' \
./util/clients/run-ab.sh
working-directory: ./libyimmo
- name: Stop HTTP Server
run: |
# Shut down the test server:
docker stop yimmo-http-server
docker rm yimmo-http-server
working-directory: ./libyimmo