Skip to content

Commit e99b461

Browse files
author
Kerkesni
committed
add coverage to functional tests
Issue: CLDSRV-618
1 parent 9219cfa commit e99b461

File tree

3 files changed

+109
-1
lines changed

3 files changed

+109
-1
lines changed

.github/actions/setup-ci/action.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ runs:
1616
run: |-
1717
set -exu;
1818
mkdir -p /tmp/artifacts/${JOB_NAME}/;
19+
- name: Setup coverage directory
20+
shell: bash
21+
run: |-
22+
set -exu;
23+
mkdir -p /tmp/coverage/${JOB_NAME}/;
1924
- uses: actions/setup-node@v4
2025
with:
2126
node-version: '22'

.github/docker/docker-compose.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,28 @@
11
services:
22
cloudserver:
33
image: ${CLOUDSERVER_IMAGE}
4-
command: sh -c "yarn start > /artifacts/s3.log"
4+
command: |
5+
bash -c "
6+
# Using tini to handle signals properly
7+
tini -s -g -- npx nyc --clean --silent yarn start > /artifacts/s3.log &
8+
PID=$$!
9+
generate_coverage() {
10+
echo 'Stopping NodeJS processes...'
11+
kill -TERM $$PID 2>/dev/null || true
12+
wait $$PID
13+
echo 'Generating coverage report...'
14+
npx nyc report --report-dir /coverage/test --reporter=lcov --reporter=text-summary
15+
}
16+
trap generate_coverage SIGTERM
17+
wait $$PID
18+
"
519
network_mode: "host"
620
volumes:
721
- /tmp/ssl:/ssl
822
- /tmp/ssl-kmip:/ssl-kmip
923
- ${HOME}/.aws/credentials:/root/.aws/credentials
1024
- /tmp/artifacts/${JOB_NAME}:/artifacts
25+
- /tmp/coverage/${JOB_NAME}:/coverage/test
1126
environment:
1227
- CI=true
1328
- ENABLE_LOCAL_CACHE=true

.github/workflows/tests.yaml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,17 @@ jobs:
253253
yarn run multiple_backend_test | tee /tmp/artifacts/${{ github.job }}/tests.log
254254
env:
255255
S3_LOCATION_FILE: tests/locationConfig/locationConfigTests.json
256+
# Stopping the services to generate coverage reports
257+
- name: Stop CI services
258+
run: docker compose --profile sproxyd --profile mongo down
259+
working-directory: .github/docker
260+
- name: Upload coverage reports to Codecov
261+
uses: codecov/codecov-action@v5
262+
with:
263+
token: ${{ secrets.CODECOV_TOKEN }}
264+
directory: /tmp/coverage/${{ github.job }}
265+
flags: ${{ github.job }}
266+
if: ${{ !cancelled() }}
256267
- name: Upload logs to artifacts
257268
uses: scality/action-artifacts@v4
258269
with:
@@ -291,6 +302,17 @@ jobs:
291302
yarn run ft_test | tee /tmp/artifacts/${{ github.job }}/tests.log
292303
env:
293304
S3_LOCATION_FILE: tests/locationConfig/locationConfigTests.json
305+
# Stopping the services to generate coverage reports
306+
- name: Stop CI services
307+
run: docker compose --profile mongo down
308+
working-directory: .github/docker
309+
- name: Upload coverage reports to Codecov
310+
uses: codecov/codecov-action@v5
311+
with:
312+
token: ${{ secrets.CODECOV_TOKEN }}
313+
directory: /tmp/coverage/${{ github.job }}
314+
flags: ${{ github.job }}
315+
if: ${{ !cancelled() }}
294316
- name: Upload logs to artifacts
295317
uses: scality/action-artifacts@v4
296318
with:
@@ -331,6 +353,17 @@ jobs:
331353
yarn run ft_mixed_bucket_format_version | tee /tmp/artifacts/${{ github.job }}/mixed-tests.log
332354
env:
333355
S3_LOCATION_FILE: tests/locationConfig/locationConfigTests.json
356+
# Stopping the services to generate coverage reports
357+
- name: Stop CI services
358+
run: docker compose --profile mongo down
359+
working-directory: .github/docker
360+
- name: Upload coverage reports to Codecov
361+
uses: codecov/codecov-action@v5
362+
with:
363+
token: ${{ secrets.CODECOV_TOKEN }}
364+
directory: /tmp/coverage/${{ github.job }}
365+
flags: ${{ github.job }}
366+
if: ${{ !cancelled() }}
334367
- name: Upload logs to artifacts
335368
uses: scality/action-artifacts@v4
336369
with:
@@ -374,6 +407,17 @@ jobs:
374407
set -o pipefail;
375408
bash wait_for_local_port.bash 8000 40
376409
yarn run ft_test | tee /tmp/artifacts/${{ matrix.job-name }}/tests.log
410+
# Stopping the services to generate coverage reports
411+
- name: Stop CI services
412+
run: docker compose down
413+
working-directory: .github/docker
414+
- name: Upload coverage reports to Codecov
415+
uses: codecov/codecov-action@v5
416+
with:
417+
token: ${{ secrets.CODECOV_TOKEN }}
418+
directory: /tmp/coverage/${{ github.job }}
419+
flags: ${{ matrix.job-name }}
420+
if: ${{ !cancelled() }}
377421
- name: Upload logs to artifacts
378422
uses: scality/action-artifacts@v4
379423
with:
@@ -408,6 +452,17 @@ jobs:
408452
set -ex -o pipefail;
409453
bash wait_for_local_port.bash 8000 40
410454
yarn run test_utapi_v2 | tee /tmp/artifacts/${{ github.job }}/tests.log
455+
# Stopping the services to generate coverage reports
456+
- name: Stop CI services
457+
run: docker compose down
458+
working-directory: .github/docker
459+
- name: Upload coverage reports to Codecov
460+
uses: codecov/codecov-action@v5
461+
with:
462+
token: ${{ secrets.CODECOV_TOKEN }}
463+
directory: /tmp/coverage/${{ github.job }}
464+
flags: ${{ github.job }}
465+
if: ${{ !cancelled() }}
411466
- name: Upload logs to artifacts
412467
uses: scality/action-artifacts@v4
413468
with:
@@ -452,6 +507,17 @@ jobs:
452507
set -ex -o pipefail;
453508
bash wait_for_local_port.bash 8000 40
454509
yarn run test_quota | tee /tmp/artifacts/${{ github.job }}/tests.log
510+
# Stopping the services to generate coverage reports
511+
- name: Stop CI services
512+
run: docker compose --profile mongo down
513+
working-directory: .github/docker
514+
- name: Upload coverage reports to Codecov
515+
uses: codecov/codecov-action@v5
516+
with:
517+
token: ${{ secrets.CODECOV_TOKEN }}
518+
directory: /tmp/coverage/${{ github.job }}
519+
flags: ${{ github.job }}${{ matrix.inflights.value == 'true' && '-inflights' || '' }}
520+
if: ${{ !cancelled() }}
455521
- name: Upload logs to artifacts
456522
uses: scality/action-artifacts@v4
457523
with:
@@ -490,6 +556,17 @@ jobs:
490556
bash wait_for_local_port.bash 8000 40
491557
bash wait_for_local_port.bash 5696 40
492558
yarn run ft_kmip | tee /tmp/artifacts/${{ github.job }}/tests.log
559+
# Stopping the services to generate coverage reports
560+
- name: Stop CI services
561+
run: docker compose --profile pykmip down
562+
working-directory: .github/docker
563+
- name: Upload coverage reports to Codecov
564+
uses: codecov/codecov-action@v5
565+
with:
566+
token: ${{ secrets.CODECOV_TOKEN }}
567+
directory: /tmp/coverage/${{ github.job }}
568+
flags: ${{ github.job }}
569+
if: ${{ !cancelled() }}
493570
- name: Upload logs to artifacts
494571
uses: scality/action-artifacts@v4
495572
with:
@@ -568,6 +645,17 @@ jobs:
568645
S3BACKEND: file
569646
S3VAULT: mem
570647
S3METADATA: mongodb
648+
# Stopping the services to generate coverage reports
649+
- name: Stop CI services
650+
run: docker compose --profile ceph down
651+
working-directory: .github/docker
652+
- name: Upload coverage reports to Codecov
653+
uses: codecov/codecov-action@v5
654+
with:
655+
token: ${{ secrets.CODECOV_TOKEN }}
656+
directory: /tmp/coverage/${{ github.job }}
657+
flags: ${{ github.job }}
658+
if: ${{ !cancelled() }}
571659
- name: Upload logs to artifacts
572660
uses: scality/action-artifacts@v4
573661
with:

0 commit comments

Comments
 (0)