-
Notifications
You must be signed in to change notification settings - Fork 3
378 lines (374 loc) · 17 KB
/
integration-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
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
name: integration-tests
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+'
pull_request_review:
types: [submitted]
workflow_dispatch:
inputs:
bob_nodes_amount:
description: 'Amount of nodes in bob cluster for tests'
required: true
default: '4'
quorum:
description: 'Quorum for bob cluster'
required: true
default: '2'
bob_vdisk_count:
description: 'Vdisks count'
required: true
default: '4'
bob_replicas_amount:
description: 'Amount of vdisks replicas'
required: true
default: '2'
bob_payload_size:
description: 'Payload size'
required: true
default: '10240'
bob_record_count:
description: 'Amount of records to process during test'
required: true
default: '100000'
bob_first_index:
description: 'Index of the first record to proceed during tests'
required: true
default: '0'
bob_bobt_count:
description: 'Amount of iterations for bobt operation test'
required: true
default: '100000'
bob_bobt_first_index:
description: 'Bottom boundary for key in bobt test'
required: true
default: '0'
bob_bobt_last_index:
description: 'Upper boundary for key in bobt test'
required: true
default: '10000'
jobs:
build-binaries:
if: ${{ github.event_name != 'pull_request_review' || github.event.review.state == 'approved' }}
strategy:
matrix:
key: [8, 16]
env:
TARGET: "x86_64-unknown-linux-musl"
BUILD_PROFILE: "integration-test"
runs-on: ubuntu-latest
steps:
- name: Checks-out repository
uses: actions/checkout@v3
- name: Set env variables and install packages
run: |
echo "BOB_COMMIT_HASH=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_ENV
echo "BOB_KEY_SIZE=${{ matrix.key }}" >> $GITHUB_ENV
sudo apt-get update && sudo apt-get install -y --no-install-recommends musl-tools
- name: Install latest stable
uses: actions-rs/toolchain@v1.0.6
with:
toolchain: stable
target: ${{ env.TARGET }}
default: true
- name: Estimate output binaries directory
run: |
echo "BUILD_PROFILE_DIR=$(case "$BUILD_PROFILE" in\
("dev") echo "debug";;\
("test") echo "debug";;\
("bench") echo "release";;\
(*) echo "$BUILD_PROFILE";;\
esac)" >> $GITHUB_ENV
- name: Output estimated working-directory
run: echo ${{ env.BUILD_PROFILE_DIR }}
- name: Build binaries
uses: actions-rs/cargo@v1.0.1
with:
command: build
args: --target=${{ env.TARGET }} --profile=${{ env.BUILD_PROFILE }}
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: bob-binaries-${{ matrix.key }}
path: |
target/${{ env.TARGET }}/${{ env.BUILD_PROFILE_DIR }}/bobd
target/${{ env.TARGET }}/${{ env.BUILD_PROFILE_DIR }}/bobp
target/${{ env.TARGET }}/${{ env.BUILD_PROFILE_DIR }}/ccg
target/${{ env.TARGET }}/${{ env.BUILD_PROFILE_DIR }}/bobt
build-docker-images:
if: ${{ github.event_name != 'pull_request_review' || github.event.review.state == 'approved' }}
runs-on: ubuntu-latest
strategy:
matrix:
key: [8, 16]
env:
BUILD_PROFILE: "integration-test"
steps:
- name: Checks-out repository
uses: actions/checkout@v3
- name: Set env
run: |
echo "VERSION=$(cat bob-apps/Cargo.toml | grep ^version | head -1 | awk '{print $3}' | sed -e 's/"//g' | sed -e 's/-/./g')" >> $GITHUB_ENV
echo "BOB_COMMIT_HASH=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_ENV
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: qoollo/bob
tags: |
${{ env.VERSION }}-key${{ matrix.key }}
- name: Build image
uses: docker/build-push-action@v2
with:
outputs: type=image,name=qoollo/bob:${{ env.VERSION }}-key${{ matrix.key }}
context: .
file: dockerfiles/alpine/Dockerfile
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
COMMIT_HASH=${{ env.BOB_COMMIT_HASH }}
KEY_SIZE=${{ matrix.key}}
BUILD_PROFILE=${{ env.BUILD_PROFILE }}
- name: Save image
run: |
docker save -o /tmp/bob-image-key${{ matrix.key }}.tar qoollo/bob:${{ env.VERSION }}-key${{ matrix.key }}
working-directory: ./integration-tests
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: bob-image-key${{ matrix.key }}
path: |
/tmp/bob-image-key${{ matrix.key }}.tar
test-put-get-exist:
if: ${{ github.event_name != 'pull_request_review' || github.event.review.state == 'approved' }}
needs: [build-binaries, build-docker-images]
strategy:
matrix:
key: [8, 16]
mode: [normal, random]
auth: [None]
include:
- key: 8
mode: normal
auth: Basic
runs-on: ubuntu-latest
steps:
- name: Checks-out repo
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Setup default variables for auto runs
run: |
INPUT="${{ github.event.inputs.bob_nodes_amount }}"
echo "BOB_NODES_AMOUNT=${INPUT:-"4"}" >> $GITHUB_ENV
INPUT="${{ github.event.inputs.bob_vdisk_count }}"
echo "BOB_VDISK_COUNT=${INPUT:-"4"}" >> $GITHUB_ENV
INPUT="${{ github.event.inputs.bob_replicas_amount }}"
echo "BOB_REPLICAS_AMOUNT=${INPUT:-"2"}" >> $GITHUB_ENV
INPUT="${{ github.event.inputs.bob_payload_size }}"
echo "BOB_PAYLOAD_SIZE=${INPUT:-"10240"}" >> $GITHUB_ENV
INPUT="${{ github.event.inputs.bob_record_count }}"
echo "BOB_RECORD_COUNT=${INPUT:-"100000"}" >> $GITHUB_ENV
INPUT="${{ github.event.inputs.bob_first_index }}"
echo "BOB_FIRST_INDEX=${INPUT:-"0"}" >> $GITHUB_ENV
INPUT="${{ github.event.inputs.bob_transport_min_port }}"
echo "BOB_TRANSPORT_MIN_PORT=${INPUT:-"20000"}" >> $GITHUB_ENV
INPUT="${{ github.event.inputs.bob_auth_user }}"
echo "BOB_AUTH_USER=${INPUT:-"admin"}" >> $GITHUB_ENV
INPUT="${{ github.event.inputs.bob_auth_password }}"
echo "BOB_AUTH_PASSWORD=${INPUT:-"password"}" >> $GITHUB_ENV
INPUT="${{ github.event.inputs.bob_rest_min_port }}"
echo "BOB_REST_MIN_PORT=${INPUT:-"8000"}" >> $GITHUB_ENV
INPUT="${{ github.event.inputs.quorum }}"
echo "BOB_CLUSTER_QUORUM=${INPUT:-"2"}" >> $GITHUB_ENV
- name: Install deps
run: |
/usr/bin/pip3 install -r ./requirements.txt
working-directory: ./integration-tests
- name: Get version data
run: |
echo "VERSION=$(cat bob-apps/Cargo.toml | grep ^version | head -1 | awk '{print $3}' | sed -e 's/"//g' | sed -e 's/-/./g')" >> $GITHUB_ENV
echo "VERSION_NO_FORMATTING=$(cat bob-apps/Cargo.toml | grep ^version | head -1 | awk '{print $3}' | sed -e 's/"//g')" >> $GITHUB_ENV
- name: Download binaries
uses: actions/download-artifact@v3
with:
name: bob-binaries-${{ matrix.key }}
path: ./integration-tests
- name: Download docker images
uses: actions/download-artifact@v3
with:
name: bob-image-key${{ matrix.key }}
path: ./integration-tests
- name: Load docker images
run: |
docker load -i ./bob-image-key${{ matrix.key }}.tar
working-directory: ./integration-tests
- name: List availible images
run: |
docker image ls
- name: Generate config files for docker and bob
run: |
./generate_from_templates.py -a ${{ env.BOB_NODES_AMOUNT }} -v qoollo/bob:${{ env.VERSION }}-key${{ matrix.key }} --path /tmp -transport_min_port ${{ env.BOB_TRANSPORT_MIN_PORT }} -rest_min_port ${{ env.BOB_REST_MIN_PORT }} --check-interval 5000ms -u ${{ matrix.auth }} -q ${{ env.BOB_CLUSTER_QUORUM }}
working-directory: ./integration-tests
- name: Deploy docker containers
run: |
./deploy.py --path /tmp/generated_configs -d ${{ env.BOB_VDISK_COUNT }} -r ${{ env.BOB_REPLICAS_AMOUNT }} -nodes_amount ${{ env.BOB_NODES_AMOUNT }} -rest_min_port ${{ env.BOB_REST_MIN_PORT }} --cluster_start_waiting_time 5000
working-directory: ./integration-tests
- name: Run write/read/exist tests
run: |
./tests.py -l ${{ env.BOB_PAYLOAD_SIZE }} -c ${{ env.BOB_RECORD_COUNT }} -f ${{ env.BOB_FIRST_INDEX }} -n 127.0.0.1 -k ${{ matrix.key }} --mode ${{ matrix.mode }} -nodes_amount ${{ env.BOB_NODES_AMOUNT }} -transport_min_port ${{ env.BOB_TRANSPORT_MIN_PORT }} --user ${{ env.BOB_AUTH_USER }} --password ${{ env.BOB_AUTH_PASSWORD }} -t 4
working-directory: ./integration-tests
test-aliens:
if: ${{ github.event_name != 'pull_request_review' || github.event.review.state == 'approved' }}
needs: [build-binaries, build-docker-images]
strategy:
matrix:
key: [8, 16]
runs-on: ubuntu-latest
steps:
- name: Checks-out repo
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Setup default variables for auto runs
run: |
INPUT="${{ github.event.inputs.bob_nodes_amount }}"
echo "BOB_NODES_AMOUNT=${INPUT:-"4"}" >> $GITHUB_ENV
INPUT="${{ github.event.inputs.bob_vdisk_count }}"
echo "BOB_VDISK_COUNT=${INPUT:-"4"}" >> $GITHUB_ENV
INPUT="${{ github.event.inputs.bob_replicas_amount }}"
echo "BOB_REPLICAS_AMOUNT=${INPUT:-"2"}" >> $GITHUB_ENV
INPUT="${{ github.event.inputs.bob_payload_size }}"
echo "BOB_PAYLOAD_SIZE=${INPUT:-"4096"}" >> $GITHUB_ENV
INPUT="${{ github.event.inputs.bob_record_count }}"
echo "BOB_RECORD_COUNT=${INPUT:-"100000"}" >> $GITHUB_ENV
INPUT="${{ github.event.inputs.bob_first_index }}"
echo "BOB_FIRST_INDEX=${INPUT:-"0"}" >> $GITHUB_ENV
INPUT="${{ github.event.inputs.bob_transport_min_port }}"
echo "BOB_TRANSPORT_MIN_PORT=${INPUT:-"20000"}" >> $GITHUB_ENV
INPUT="${{ github.event.inputs.bob_rest_min_port }}"
echo "BOB_REST_MIN_PORT=${INPUT:-"8000"}" >> $GITHUB_ENV
INPUT="${{ github.event.inputs.quorum }}"
echo "BOB_CLUSTER_QUORUM=${INPUT:-"2"}" >> $GITHUB_ENV
- name: Install deps
run: |
/usr/bin/pip3 install -r ./requirements.txt
working-directory: ./integration-tests
- name: Get version data
run: |
echo "VERSION=$(cat bob-apps/Cargo.toml | grep ^version | head -1 | awk '{print $3}' | sed -e 's/"//g' | sed -e 's/-/./g')" >> $GITHUB_ENV
echo "VERSION_NO_FORMATTING=$(cat bob-apps/Cargo.toml | grep ^version | head -1 | awk '{print $3}' | sed -e 's/"//g')" >> $GITHUB_ENV
- name: Download binaries
uses: actions/download-artifact@v3
with:
name: bob-binaries-${{ matrix.key }}
path: ./integration-tests
- name: Download docker images
uses: actions/download-artifact@v3
with:
name: bob-image-key${{ matrix.key }}
path: ./integration-tests
- name: Load docker images
run: |
docker load -i ./bob-image-key${{ matrix.key }}.tar
working-directory: ./integration-tests
- name: List availible images
run: |
docker image ls
- name: Generate config files for docker and bob
run: |
./generate_from_templates.py -a ${{ env.BOB_NODES_AMOUNT }} -v qoollo/bob:${{ env.VERSION }}-key${{ matrix.key }} --path /tmp -transport_min_port ${{ env.BOB_TRANSPORT_MIN_PORT }} -rest_min_port ${{ env.BOB_REST_MIN_PORT }} --check-interval 5000ms -q ${{ env.BOB_CLUSTER_QUORUM }}
working-directory: ./integration-tests
- name: Deploy docker containers
run: |
./deploy.py --path /tmp/generated_configs -d ${{ env.BOB_VDISK_COUNT }} -r ${{ env.BOB_REPLICAS_AMOUNT }} -nodes_amount ${{ env.BOB_NODES_AMOUNT }} -rest_min_port ${{ env.BOB_REST_MIN_PORT }} --cluster_start_waiting_time 5000
working-directory: ./integration-tests
- name: Run alien tests
run: |
./tests_aliens.py -l ${{ env.BOB_PAYLOAD_SIZE }} -c ${{ env.BOB_RECORD_COUNT }} -f ${{ env.BOB_FIRST_INDEX }} -n 127.0.0.1 -k ${{ matrix.key }} -nodes_amount ${{ env.BOB_NODES_AMOUNT }} -transport_min_port ${{ env.BOB_TRANSPORT_MIN_PORT }} -rest_min_port ${{ env.BOB_REST_MIN_PORT }} --cluster_start_waiting_time 5000
working-directory: ./integration-tests
test-with-bobt:
if: ${{ github.event_name != 'pull_request_review' || github.event.review.state == 'approved' }}
needs: [build-binaries, build-docker-images]
strategy:
matrix:
key: [8, 16]
auth: [None]
include:
- key: 8
auth: Basic
runs-on: ubuntu-latest
steps:
- name: Checks-out repo
uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Setup default variables for auto runs
run: |
INPUT="${{ github.event.inputs.bob_nodes_amount }}"
echo "BOB_NODES_AMOUNT=${INPUT:-"4"}" >> $GITHUB_ENV
INPUT="${{ github.event.inputs.bob_vdisk_count }}"
echo "BOB_VDISK_COUNT=${INPUT:-"4"}" >> $GITHUB_ENV
INPUT="${{ github.event.inputs.bob_replicas_amount }}"
echo "BOB_REPLICAS_AMOUNT=${INPUT:-"2"}" >> $GITHUB_ENV
INPUT="${{ github.event.inputs.bob_bobt_first_index }}"
echo "BOB_BOBT_FIRST_INDEX=${INPUT:-"0"}" >> $GITHUB_ENV
INPUT="${{ github.event.inputs.bob_bobt_last_index }}"
echo "BOB_BOBT_LAST_INDEX=${INPUT:-"10000"}" >> $GITHUB_ENV
INPUT="${{ github.event.inputs.bob_bobt_count }}"
echo "BOB_BOBT_COUNT=${INPUT:-"100000"}" >> $GITHUB_ENV
INPUT="${{ github.event.inputs.bob_transport_min_port }}"
echo "BOB_TRANSPORT_MIN_PORT=${INPUT:-"20000"}" >> $GITHUB_ENV
INPUT="${{ github.event.inputs.bob_auth_user }}"
echo "BOB_AUTH_USER=${INPUT:-"admin"}" >> $GITHUB_ENV
INPUT="${{ github.event.inputs.bob_auth_password }}"
echo "BOB_AUTH_PASSWORD=${INPUT:-"password"}" >> $GITHUB_ENV
INPUT="${{ github.event.inputs.bob_rest_min_port }}"
echo "BOB_REST_MIN_PORT=${INPUT:-"8000"}" >> $GITHUB_ENV
INPUT="${{ github.event.inputs.quorum }}"
echo "BOB_CLUSTER_QUORUM=${INPUT:-"2"}" >> $GITHUB_ENV
- name: Install deps
run: |
/usr/bin/pip3 install -r ./requirements.txt
working-directory: ./integration-tests
- name: Get version data
run: |
echo "VERSION=$(cat bob-apps/Cargo.toml | grep ^version | head -1 | awk '{print $3}' | sed -e 's/"//g' | sed -e 's/-/./g')" >> $GITHUB_ENV
echo "VERSION_NO_FORMATTING=$(cat bob-apps/Cargo.toml | grep ^version | head -1 | awk '{print $3}' | sed -e 's/"//g')" >> $GITHUB_ENV
- name: Download binaries
uses: actions/download-artifact@v3
with:
name: bob-binaries-${{ matrix.key }}
path: ./integration-tests
- name: Download docker images
uses: actions/download-artifact@v3
with:
name: bob-image-key${{ matrix.key }}
path: ./integration-tests
- name: Load docker images
run: |
docker load -i ./bob-image-key${{ matrix.key }}.tar
working-directory: ./integration-tests
- name: List availible images
run: |
docker image ls
- name: Generate config files for docker and bob
run: |
./generate_from_templates.py -a ${{ env.BOB_NODES_AMOUNT }} -v qoollo/bob:${{ env.VERSION }}-key${{ matrix.key }} --path /tmp -transport_min_port ${{ env.BOB_TRANSPORT_MIN_PORT }} -rest_min_port ${{ env.BOB_REST_MIN_PORT }} -u ${{ matrix.auth }} --check-interval 5000ms -q ${{ env.BOB_CLUSTER_QUORUM }}
working-directory: ./integration-tests
- name: Deploy docker containers
run: |
./deploy.py --path /tmp/generated_configs -d ${{ env.BOB_VDISK_COUNT }} -r ${{ env.BOB_REPLICAS_AMOUNT }} -nodes_amount ${{ env.BOB_NODES_AMOUNT }} -rest_min_port ${{ env.BOB_REST_MIN_PORT }} --cluster_start_waiting_time 5000
working-directory: ./integration-tests
- name: Run tests with bobt
run: |
./tests_bobt.py -c ${{ env.BOB_BOBT_COUNT }} -s ${{ env.BOB_BOBT_FIRST_INDEX }} -e ${{ env.BOB_BOBT_LAST_INDEX }} --user ${{ env.BOB_AUTH_USER }} --password ${{ env.BOB_AUTH_PASSWORD }} -rest_min_port ${{ env.BOB_REST_MIN_PORT }}
working-directory: ./integration-tests