-
Notifications
You must be signed in to change notification settings - Fork 15
386 lines (327 loc) · 13.7 KB
/
s3-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
379
380
381
382
383
384
385
386
name: S3 tests
on:
push:
branches:
- master
pull_request:
branches:
- master
- support/**
types: [opened, synchronize]
paths-ignore:
- '**/*.md'
release:
types:
- published
workflow_dispatch:
inputs:
neofs-s3-gw_ref:
description: 'neofs-s3-gw ref. Default ref - latest master. Examples: v0.27.0, 8fdcc6d7e798e6511be8806b81894622e72d7fdc, branch_name'
required: false
default: ''
permissions: write-all
env:
S3_TESTS_CONFIG: s3tests.conf
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Get the current date
id: date
shell: bash
run: echo "::set-output name=timestamp::$(date +%s)"
- name: Set RUN_ID
env:
TIMESTAMP: ${{ steps.date.outputs.timestamp }}
run: echo "RUN_ID=${{ github.run_number }}-$TIMESTAMP" >> $GITHUB_ENV
- name: Checkout neofs-s3-gw repository
uses: actions/checkout@v3
with:
path: neofs-s3-gw
- name: Checkout s3-tests repository
uses: actions/checkout@v3
with:
repository: nspcc-dev/s3-tests
ref: master
path: s3-tests
- name: Checkout neofs-dev-env repository
uses: actions/checkout@v3
with:
repository: nspcc-dev/neofs-dev-env
ref: master
path: neofs-dev-env
- name: Checkout neofs-s3-dev-env repository
uses: actions/checkout@v3
with:
repository: nspcc-dev/neofs-s3-dev-env
ref: master
path: neofs-s3-dev-env
- name: Download latest stable neofs-cli for uploading reports to NeoFS
uses: dsaltares/[email protected]
with:
repo: 'nspcc-dev/neofs-node'
version: 'tags/v0.37.0'
file: 'neofs-cli-amd64'
target: 'neofs-node-stable/neofs-cli'
- name: Checkout neofs-testcases repository
uses: actions/checkout@v3
with:
repository: nspcc-dev/neofs-testcases
ref: 'master'
path: neofs-testcases
################################################################
- name: Set up Go
uses: actions/setup-go@v4
with:
cache: true
go-version: '1.21'
- run: go version
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.8'
- run: python --version
################################################################
- name: Get TAG for docker images
run: |
echo "CURRENT_TAG=$( make version | sed 's/^v//' )" >> $GITHUB_ENV
working-directory: neofs-s3-gw
################################################################
- name: Build neofs-s3-gw docker image
run: |
make
working-directory: neofs-s3-gw
- name: Build neofs-s3-gw binaries
run: |
make image
working-directory: neofs-s3-gw
#################################################################
- name: Add NeoFS S3-gw TAGs to s3-gw-test env config
run: |
sed -i -e 's/S3_GW_VERSION=_TAG_/S3_GW_VERSION=${{ env.CURRENT_TAG }}/' .github/test-env
working-directory: neofs-s3-gw
- name: Copy test-env file to .env for neofs-dev-env
run: |
cp .github/test-env ${GITHUB_WORKSPACE}/neofs-dev-env/.env
working-directory: neofs-s3-gw
################################################################
- name: Prepare hosts
timeout-minutes: 5
run: |
make get
sudo ./bin/update_hosts.sh
sudo chmod a+w vendor/hosts
working-directory: neofs-dev-env
- name: Prepare Dev-Env to run tests
id: prepare_test_env
timeout-minutes: 30
run: |
make prepare-test-env
echo "$(pwd)/vendor" >> $GITHUB_PATH
working-directory: neofs-dev-env
- name: Set zero fee
run: |
make update.container_fee val=0 && make update.container_alias_fee val=0
working-directory: neofs-dev-env
- name: Copy neofs-s3-gw binaries to vendor directory
run: |
cp bin/* ${GITHUB_WORKSPACE}/neofs-dev-env/vendor/
working-directory: neofs-s3-gw
################################################################
- name: Log environment
run: |
echo "Check free space"
df -h
echo "=========================================="
echo "Check /etc/hosts"
cat /etc/hosts
echo "=========================================="
echo "Check docker images"
docker images
echo "=========================================="
echo "Check docker ps"
docker ps
echo "=========================================="
echo "Check neo-go version"
neo-go --version
echo "=========================================="
echo "Check neofs-s3-authmate version"
neofs-s3-authmate --version
echo "=========================================="
echo "Check neofs-s3-gw version"
echo "=========================================="
neofs-s3-gw --version
echo "=========================================="
echo "Check neofs-adm version"
neofs-adm --version
echo "=========================================="
echo "Check neofs-cli version"
neofs-cli --version
echo "=========================================="
echo "Check vendor dir"
ls -lah "${GITHUB_WORKSPACE}/neofs-dev-env/vendor"
echo "=========================================="
working-directory: neofs-dev-env
################################################################
- name: Copy test-env file to .env for neofs-s3-dev-env
run: |
cp .env ${GITHUB_WORKSPACE}/neofs-s3-dev-env/.env
working-directory: neofs-dev-env
- name: Copy neofs-s3-authmate for neofs-s3-dev-env
run: |
cp ${GITHUB_WORKSPACE}/neofs-dev-env/vendor/neofs-s3-authmate bin/s3-authmate
working-directory: neofs-s3-dev-env
- name: Prepare test S3-gw test env
run: |
make prepare.s3-gw
working-directory: neofs-s3-dev-env
- name: Copy s3tests config to s3-tests directory
run: |
cp services/s3-gw/s3tests.conf ${GITHUB_WORKSPACE}/s3-tests/${S3_TESTS_CONFIG}
working-directory: neofs-s3-dev-env
- name: Test config
run: |
cat ${S3_TESTS_CONFIG}
working-directory: s3-tests
- name: Setup test env
run: |
python3.8 -m venv virtualenv
./bootstrap
working-directory: s3-tests
- name: s3 tests
run: |
source virtualenv/bin/activate
S3TEST_CONF=${S3_TESTS_CONFIG} pytest -m 'not fails_on_aws and not fails_on_dbstore' --alluredir=${GITHUB_WORKSPACE}/allure-results -v -s s3tests_boto3/functional/test_s3.py s3tests_boto3/functional/test_s3_neofs.py 2>&1 | tee s3-tests.log
working-directory: s3-tests
################################################################
- name: Generate Allure report
timeout-minutes: 60
uses: simple-elf/[email protected]
if: always()
id: allure-report
with:
keep_reports: 100000
allure_results: allure-results
allure_report: allure-report
allure_history: allure-history
- name: Enable stable neofs-cli
if: always()
run: |
echo "$(pwd)" >> $GITHUB_PATH
working-directory: neofs-node-stable
- name: Create wallet
if: always()
env:
TEST_RESULTS_WALLET: ${{ secrets.TEST_RESULTS_WALLET }}
run: |
echo "$TEST_RESULTS_WALLET" | base64 -d > wallet.json
working-directory: neofs-testcases
- name: Define expiration
if: always()
env:
TEST_RESULTS_NEOFS_NETWORK_DOMAIN: ${{ vars.TEST_RESULTS_NEOFS_NETWORK_DOMAIN }}
MASTER_EXPIRATION_PERIOD: ${{ vars.MASTER_EXPIRATION_PERIOD }}
PR_EXPIRATION_PERIOD: ${{ vars.PR_EXPIRATION_PERIOD }}
MANUAL_RUN_EXPIRATION_PERIOD: ${{ vars.MANUAL_RUN_EXPIRATION_PERIOD }}
OTHER_EXPIRATION_PERIOD: ${{ vars.OTHER_EXPIRATION_PERIOD }}
run: |
CURRENT_EPOCH=$(neofs-cli netmap epoch --rpc-endpoint st1.$TEST_RESULTS_NEOFS_NETWORK_DOMAIN:8080)
if [[ "${{ github.event_name }}" == "push" ]]; then
EXP_EPOCH=$((MASTER_EXPIRATION_PERIOD + CURRENT_EPOCH))
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
EXP_EPOCH=$((PR_EXPIRATION_PERIOD + CURRENT_EPOCH))
elif [[ "${{ github.event_name }}" == "release" ]]; then
EXP_EPOCH=0 # For test reports from releases - no expiration period
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
EXP_EPOCH=$((MANUAL_RUN_EXPIRATION_PERIOD + CURRENT_EPOCH))
else
EXP_EPOCH=$((OTHER_EXPIRATION_PERIOD + CURRENT_EPOCH))
fi
echo "EXP_EPOCH=$EXP_EPOCH" >> $GITHUB_ENV
working-directory: neofs-testcases
- name: Put allure report to NeoFS
id: put_report
if: always() && steps.prepare_test_env.outcome == 'success'
env:
TEST_RESULTS_PASSWORD: ${{ secrets.TEST_RESULTS_PASSWORD }}
TEST_RESULTS_NEOFS_NETWORK_DOMAIN: ${{ vars.TEST_RESULTS_NEOFS_NETWORK_DOMAIN }}
TEST_RESULTS_CID: ${{ vars.TEST_RESULTS_CID }}
run: |
sudo chmod -R a+rw ${GITHUB_WORKSPACE}/allure-report
source ${GITHUB_WORKSPACE}/s3-tests/virtualenv/bin/activate
python ./tools/src/process-allure-reports.py \
--expire-at $EXP_EPOCH \
--neofs_domain $TEST_RESULTS_NEOFS_NETWORK_DOMAIN \
--run_id $RUN_ID --cid $TEST_RESULTS_CID \
--allure_report ${GITHUB_WORKSPACE}/allure-report \
--wallet wallet.json
working-directory: neofs-testcases
- name: Post the link to the report
id: post_report_link
timeout-minutes: 60
if: always() && steps.put_report.outcome == 'success'
env:
TEST_RESULTS_HTTP_GATE: ${{ vars.TEST_RESULTS_HTTP_GATE }}
TEST_RESULTS_CID: ${{ vars.TEST_RESULTS_CID }}
uses: Sibz/github-status-action@v1
with:
authToken: ${{secrets.GITHUB_TOKEN}}
context: 'Test report'
state: 'success'
sha: ${{github.event.pull_request.head.sha || github.sha}}
target_url: https://${{ env.TEST_RESULTS_HTTP_GATE }}/${{ env.TEST_RESULTS_CID }}/${{ env.RUN_ID }}/index.html
- name: Post only tests logs
id: post_s3_tests_logs
if: always()
env:
TEST_RESULTS_PASSWORD: ${{ secrets.TEST_RESULTS_PASSWORD }}
TEST_RESULTS_NEOFS_NETWORK_DOMAIN: ${{ vars.TEST_RESULTS_NEOFS_NETWORK_DOMAIN }}
TEST_RESULTS_CID: ${{ vars.TEST_RESULTS_CID }}
run: |
source ${GITHUB_WORKSPACE}/s3-tests/virtualenv/bin/activate
zip s3-tests.zip ${GITHUB_WORKSPACE}/s3-tests/s3-tests.log
NEOFS_CLI_PASSWORD=$TEST_RESULTS_PASSWORD neofs-cli --rpc-endpoint st1.$TEST_RESULTS_NEOFS_NETWORK_DOMAIN:8080 \
--wallet wallet.json object put --file s3-tests.zip --cid $TEST_RESULTS_CID --timeout 1200s \
--expire-at $EXP_EPOCH \
--attributes FilePath=$RUN_ID/data/s3-tests.zip,RunNumber=$RUN_ID,ContentType=application/zip
working-directory: neofs-testcases
- name: Post the link to the tests logs
timeout-minutes: 60
if: always() && ( steps.post_s3_tests_logs.outcome == 'success' )
env:
TEST_RESULTS_HTTP_GATE: ${{ vars.TEST_RESULTS_HTTP_GATE }}
TEST_RESULTS_CID: ${{ vars.TEST_RESULTS_CID }}
uses: Sibz/github-status-action@v1
with:
authToken: ${{secrets.GITHUB_TOKEN}}
context: 'S3 tests logs'
state: 'success'
sha: ${{github.event.pull_request.head.sha || github.sha}}
target_url: https://${{ env.TEST_RESULTS_HTTP_GATE }}/${{ env.TEST_RESULTS_CID }}/${{ env.RUN_ID }}/data/s3-tests.zip
- name: Post only docker logs
id: post_dockers_logs
if: always() && ( steps.prepare_test_env.outcome != 'success' || steps.put_report.outcome != 'success' )
env:
TEST_RESULTS_PASSWORD: ${{ secrets.TEST_RESULTS_PASSWORD }}
TEST_RESULTS_NEOFS_NETWORK_DOMAIN: ${{ vars.TEST_RESULTS_NEOFS_NETWORK_DOMAIN }}
TEST_RESULTS_CID: ${{ vars.TEST_RESULTS_CID }}
run: |
source venv.local-pytest/bin/activate && python ./tools/src/zip_dev_env_logs.py
NEOFS_CLI_PASSWORD=$TEST_RESULTS_PASSWORD neofs-cli --rpc-endpoint st1.$TEST_RESULTS_NEOFS_NETWORK_DOMAIN:8080 \
--wallet wallet.json object put --file containers_logs.zip --cid $TEST_RESULTS_CID --timeout 1200s \
--expire-at $EXP_EPOCH \
--attributes FilePath=$RUN_ID/data/containers_logs.zip,RunNumber=$RUN_ID,ContentType=application/zip
working-directory: neofs-testcases
- name: Post the link to the docker logs
timeout-minutes: 60
if: always() && ( steps.post_dockers_logs.outcome == 'success' )
env:
TEST_RESULTS_HTTP_GATE: ${{ vars.TEST_RESULTS_HTTP_GATE }}
TEST_RESULTS_CID: ${{ vars.TEST_RESULTS_CID }}
uses: Sibz/github-status-action@v1
with:
authToken: ${{secrets.GITHUB_TOKEN}}
context: 'Docker logs'
state: 'success'
sha: ${{github.event.pull_request.head.sha || github.sha}}
target_url: https://${{ env.TEST_RESULTS_HTTP_GATE }}/${{ env.TEST_RESULTS_CID }}/${{ env.RUN_ID }}/data/containers_logs.zip