Skip to content

Commit 1a13e70

Browse files
author
Kerkesni
committed
add coverage to functional tests
Issue: CLDSRV-618
1 parent 1915beb commit 1a13e70

2 files changed

Lines changed: 75 additions & 1 deletion

File tree

.github/docker/docker-compose.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
services:
22
cloudserver:
33
image: ${CLOUDSERVER_IMAGE}
4-
command: sh -c "yarn start > /artifacts/s3.log"
4+
command: |
5+
bash -c "
6+
cover() {
7+
echo 'Container stopped, generating coverage reports...'
8+
npx nyc report --report-dir /coverage/test --reporter=lcov
9+
}
10+
trap cover SIGTERM
11+
npx nyc --clean --silent yarn start &
12+
wait $!
13+
"
514
network_mode: "host"
615
volumes:
716
- /tmp/ssl:/ssl
817
- /tmp/ssl-kmip:/ssl-kmip
918
- ${HOME}/.aws/credentials:/root/.aws/credentials
1019
- /tmp/artifacts/${JOB_NAME}:/artifacts
20+
- ${COVERAGE_DIR}:/coverage/test
1121
environment:
1222
- CI=true
1323
- ENABLE_LOCAL_CACHE=true

.github/workflows/tests.yaml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ jobs:
231231
S3DATA: multiple
232232
S3METADATA: mongodb
233233
JOB_NAME: ${{ github.job }}
234+
COVERAGE_DIR: ./coverage/test
234235
steps:
235236
- name: Checkout
236237
uses: actions/checkout@v4
@@ -253,6 +254,13 @@ jobs:
253254
yarn run multiple_backend_test | tee /tmp/artifacts/${{ github.job }}/tests.log
254255
env:
255256
S3_LOCATION_FILE: tests/locationConfig/locationConfigTests.json
257+
- name: Upload coverage reports to Codecov
258+
uses: codecov/codecov-action@v5
259+
with:
260+
token: ${{ secrets.CODECOV_TOKEN }}
261+
directory: ${{ env.COVERAGE_DIR }}
262+
flags: ${{ github.job }}
263+
if: ${{ !cancelled() }}
256264
- name: Upload logs to artifacts
257265
uses: scality/action-artifacts@v4
258266
with:
@@ -276,6 +284,7 @@ jobs:
276284
MONGODB_IMAGE: ghcr.io/${{ github.repository }}/ci-mongodb:${{ github.sha }}
277285
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}
278286
JOB_NAME: ${{ github.job }}
287+
COVERAGE_DIR: ./coverage/test
279288
steps:
280289
- name: Checkout
281290
uses: actions/checkout@v4
@@ -291,6 +300,13 @@ jobs:
291300
yarn run ft_test | tee /tmp/artifacts/${{ github.job }}/tests.log
292301
env:
293302
S3_LOCATION_FILE: tests/locationConfig/locationConfigTests.json
303+
- name: Upload coverage reports to Codecov
304+
uses: codecov/codecov-action@v5
305+
with:
306+
token: ${{ secrets.CODECOV_TOKEN }}
307+
directory: ${{ env.COVERAGE_DIR }}
308+
flags: ${{ github.job }}
309+
if: ${{ !cancelled() }}
294310
- name: Upload logs to artifacts
295311
uses: scality/action-artifacts@v4
296312
with:
@@ -315,6 +331,7 @@ jobs:
315331
MONGODB_IMAGE: ghcr.io/${{ github.repository }}/ci-mongodb:${{ github.sha }}
316332
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}
317333
JOB_NAME: ${{ github.job }}
334+
COVERAGE_DIR: ./coverage/test
318335
steps:
319336
- name: Checkout
320337
uses: actions/checkout@v4
@@ -331,6 +348,13 @@ jobs:
331348
yarn run ft_mixed_bucket_format_version | tee /tmp/artifacts/${{ github.job }}/mixed-tests.log
332349
env:
333350
S3_LOCATION_FILE: tests/locationConfig/locationConfigTests.json
351+
- name: Upload coverage reports to Codecov
352+
uses: codecov/codecov-action@v5
353+
with:
354+
token: ${{ secrets.CODECOV_TOKEN }}
355+
directory: ${{ env.COVERAGE_DIR }}
356+
flags: ${{ github.job }}
357+
if: ${{ !cancelled() }}
334358
- name: Upload logs to artifacts
335359
uses: scality/action-artifacts@v4
336360
with:
@@ -356,6 +380,7 @@ jobs:
356380
MONGODB_IMAGE: ghcr.io/${{ github.repository }}/ci-mongodb:${{ github.sha }}
357381
MPU_TESTING: "yes"
358382
JOB_NAME: ${{ matrix.job-name }}
383+
COVERAGE_DIR: ./coverage/test
359384
steps:
360385
- name: Checkout
361386
uses: actions/checkout@v4
@@ -374,6 +399,13 @@ jobs:
374399
set -o pipefail;
375400
bash wait_for_local_port.bash 8000 40
376401
yarn run ft_test | tee /tmp/artifacts/${{ matrix.job-name }}/tests.log
402+
- name: Upload coverage reports to Codecov
403+
uses: codecov/codecov-action@v5
404+
with:
405+
token: ${{ secrets.CODECOV_TOKEN }}
406+
directory: ${{ env.COVERAGE_DIR }}
407+
flags: ${{ matrix.job-name }}
408+
if: ${{ !cancelled() }}
377409
- name: Upload logs to artifacts
378410
uses: scality/action-artifacts@v4
379411
with:
@@ -395,6 +427,7 @@ jobs:
395427
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}
396428
MONGODB_IMAGE: ghcr.io/${{ github.repository }}/ci-mongodb:${{ github.sha }}
397429
JOB_NAME: ${{ github.job }}
430+
COVERAGE_DIR: ./coverage/test
398431
steps:
399432
- name: Checkout
400433
uses: actions/checkout@v4
@@ -408,6 +441,13 @@ jobs:
408441
set -ex -o pipefail;
409442
bash wait_for_local_port.bash 8000 40
410443
yarn run test_utapi_v2 | tee /tmp/artifacts/${{ github.job }}/tests.log
444+
- name: Upload coverage reports to Codecov
445+
uses: codecov/codecov-action@v5
446+
with:
447+
token: ${{ secrets.CODECOV_TOKEN }}
448+
directory: ${{ env.COVERAGE_DIR }}
449+
flags: ${{ github.job }}
450+
if: ${{ !cancelled() }}
411451
- name: Upload logs to artifacts
412452
uses: scality/action-artifacts@v4
413453
with:
@@ -439,6 +479,7 @@ jobs:
439479
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}
440480
MONGODB_IMAGE: ghcr.io/${{ github.repository }}/ci-mongodb:${{ github.sha }}
441481
JOB_NAME: ${{ github.job }}
482+
COVERAGE_DIR: ./coverage/test
442483
steps:
443484
- name: Checkout
444485
uses: actions/checkout@v4
@@ -452,6 +493,13 @@ jobs:
452493
set -ex -o pipefail;
453494
bash wait_for_local_port.bash 8000 40
454495
yarn run test_quota | tee /tmp/artifacts/${{ github.job }}/tests.log
496+
- name: Upload coverage reports to Codecov
497+
uses: codecov/codecov-action@v5
498+
with:
499+
token: ${{ secrets.CODECOV_TOKEN }}
500+
directory: ${{ env.COVERAGE_DIR }}
501+
flags: ${{ github.job }}${{ matrix.inflights.value == 'true' && '-inflights' || '' }}
502+
if: ${{ !cancelled() }}
455503
- name: Upload logs to artifacts
456504
uses: scality/action-artifacts@v4
457505
with:
@@ -473,6 +521,7 @@ jobs:
473521
PYKMIP_IMAGE: ghcr.io/${{ github.repository }}/pykmip:${{ github.sha }}
474522
MONGODB_IMAGE: ghcr.io/${{ github.repository }}/ci-mongodb:${{ github.sha }}
475523
JOB_NAME: ${{ github.job }}
524+
COVERAGE_DIR: ./coverage/test
476525
steps:
477526
- name: Checkout
478527
uses: actions/checkout@v4
@@ -490,6 +539,13 @@ jobs:
490539
bash wait_for_local_port.bash 8000 40
491540
bash wait_for_local_port.bash 5696 40
492541
yarn run ft_kmip | tee /tmp/artifacts/${{ github.job }}/tests.log
542+
- name: Upload coverage reports to Codecov
543+
uses: codecov/codecov-action@v5
544+
with:
545+
token: ${{ secrets.CODECOV_TOKEN }}
546+
directory: ${{ env.COVERAGE_DIR }}
547+
flags: ${{ github.job }}
548+
if: ${{ !cancelled() }}
493549
- name: Upload logs to artifacts
494550
uses: scality/action-artifacts@v4
495551
with:
@@ -513,6 +569,7 @@ jobs:
513569
MONGODB_IMAGE: ghcr.io/${{ github.repository }}/ci-mongodb:${{ github.sha }}
514570
CLOUDSERVER_IMAGE: ghcr.io/${{ github.repository }}:${{ github.sha }}
515571
JOB_NAME: ${{ github.job }}
572+
COVERAGE_DIR: ./coverage/test
516573
steps:
517574
- name: Checkout
518575
uses: actions/checkout@v4
@@ -568,6 +625,13 @@ jobs:
568625
S3BACKEND: file
569626
S3VAULT: mem
570627
S3METADATA: mongodb
628+
- name: Upload coverage reports to Codecov
629+
uses: codecov/codecov-action@v5
630+
with:
631+
token: ${{ secrets.CODECOV_TOKEN }}
632+
directory: ${{ env.COVERAGE_DIR }}
633+
flags: ${{ github.job }}
634+
if: ${{ !cancelled() }}
571635
- name: Upload logs to artifacts
572636
uses: scality/action-artifacts@v4
573637
with:

0 commit comments

Comments
 (0)