Skip to content

Commit 4e55a04

Browse files
authored
test(NODE-3897): re-enable combined coverage (mongodb#3375)
1 parent f1c5c3c commit 4e55a04

File tree

4 files changed

+84
-23
lines changed

4 files changed

+84
-23
lines changed

.evergreen/config.in.yml

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ functions:
850850
local_file: src/coverage/coverage-final.json
851851
optional: true
852852
# Upload the coverage report for all tasks in a single build to the same directory.
853-
# TODO NODE-3897 - change upload directory to mongo-node-driver-next
853+
# TODO NODE-4707 - change upload directory to ${UPLOAD_BUCKET}
854854
# This change will require changing the `download and merge coverage` func as well
855855
remote_file: mongo-node-driver/${revision}/${version_id}/coverage.${build_variant}.${task_name}.json
856856
bucket: mciuploads
@@ -861,21 +861,45 @@ functions:
861861
"download and merge coverage":
862862
- command: shell.exec
863863
params:
864-
silent: true
865864
working_dir: "src"
866865
script: |
867866
${PREPARE_SHELL}
868867
export AWS_ACCESS_KEY_ID=${aws_key}
869868
export AWS_SECRET_ACCESS_KEY=${aws_secret}
870-
# Download all the task coverage files.
871-
# TODO NODE-3897 - finish this function. the code below this point is untested because
872-
# aws s3 cp fails due to permissions errors
873-
aws s3 cp --recursive s3://mciuploads/mongo-node-driver/${revision}/${version_id}/ coverage/
874869
870+
# Download all the task coverage files.
871+
# NOTE: All coverage files are too large for V8 to handle the resulting call to
872+
# JSON.stringify from within nyc, so with stick to Fermiun to include the
873+
# compression tests.
874+
aws s3 cp --recursive s3://mciuploads/mongo-node-driver/${revision}/${version_id}/ \
875+
coverage/ \
876+
--exclude "*rhel80-large*" \
877+
--include "*fermiun"
878+
879+
# npx does not recognize the dependency so install it directly.
880+
npm install @istanbuljs/nyc-config-typescript
881+
cd coverage
882+
sed -i'' -e 's/\/data\/mci\/.\{32\}\/src\///g' *
883+
ls -la
884+
cd ..
875885
npx nyc merge coverage/ merged-coverage/coverage.json
876-
npx nyc report -t merged-coverage --reporter=html --report-dir output
886+
npx nyc report -t merged-coverage/ --reporter=html --report-dir coverage-report
877887
878-
aws s3 cp output/lcov-report s3://mciuploads/mongo-node-driver/${revision}/${version_id}//lcov-report/
888+
aws s3 cp coverage-report/ \
889+
s3://mciuploads/mongo-node-driver/${revision}/${version_id}/coverage/ \
890+
--recursive \
891+
--acl public-read \
892+
--region us-east-1
893+
- command: s3.put
894+
params:
895+
aws_key: ${aws_key}
896+
aws_secret: ${aws_secret}
897+
local_file: src/coverage-report/index.html
898+
remote_file: mongo-node-driver/${revision}/${version_id}/coverage/index.html
899+
bucket: mciuploads
900+
permissions: public-read
901+
content_type: text/html
902+
display_name: "Coverage Report HTML"
879903

880904
"run spec driver benchmarks":
881905
- command: subprocess.exec

.evergreen/config.yml

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -809,21 +809,45 @@ functions:
809809
download and merge coverage:
810810
- command: shell.exec
811811
params:
812-
silent: true
813812
working_dir: src
814813
script: |
815814
${PREPARE_SHELL}
816815
export AWS_ACCESS_KEY_ID=${aws_key}
817816
export AWS_SECRET_ACCESS_KEY=${aws_secret}
817+
818818
# Download all the task coverage files.
819-
# TODO NODE-3897 - finish this function. the code below this point is untested because
820-
# aws s3 cp fails due to permissions errors
821-
aws s3 cp --recursive s3://mciuploads/mongo-node-driver/${revision}/${version_id}/ coverage/
819+
# NOTE: All coverage files are too large for V8 to handle the resulting call to
820+
# JSON.stringify from within nyc, so with stick to Fermiun to include the
821+
# compression tests.
822+
aws s3 cp --recursive s3://mciuploads/mongo-node-driver/${revision}/${version_id}/ \
823+
coverage/ \
824+
--exclude "*rhel80-large*" \
825+
--include "*fermiun"
822826
827+
# npx does not recognize the dependency so install it directly.
828+
npm install @istanbuljs/nyc-config-typescript
829+
cd coverage
830+
sed -i'' -e 's/\/data\/mci\/.\{32\}\/src\///g' *
831+
ls -la
832+
cd ..
823833
npx nyc merge coverage/ merged-coverage/coverage.json
824-
npx nyc report -t merged-coverage --reporter=html --report-dir output
834+
npx nyc report -t merged-coverage/ --reporter=html --report-dir coverage-report
825835
826-
aws s3 cp output/lcov-report s3://mciuploads/mongo-node-driver/${revision}/${version_id}//lcov-report/
836+
aws s3 cp coverage-report/ \
837+
s3://mciuploads/mongo-node-driver/${revision}/${version_id}/coverage/ \
838+
--recursive \
839+
--acl public-read \
840+
--region us-east-1
841+
- command: s3.put
842+
params:
843+
aws_key: ${aws_key}
844+
aws_secret: ${aws_secret}
845+
local_file: src/coverage-report/index.html
846+
remote_file: mongo-node-driver/${revision}/${version_id}/coverage/index.html
847+
bucket: mciuploads
848+
permissions: public-read
849+
content_type: text/html
850+
display_name: Coverage Report HTML
827851
run spec driver benchmarks:
828852
- command: subprocess.exec
829853
type: test
@@ -2061,6 +2085,15 @@ tasks:
20612085
vars:
20622086
NODE_LTS_NAME: gallium
20632087
- func: run mongosh integration tests
2088+
- name: download-and-merge-coverage
2089+
tags: []
2090+
commands:
2091+
- func: download and merge coverage
2092+
depends_on:
2093+
- name: '*'
2094+
variant: '*'
2095+
status: '*'
2096+
patch_optional: true
20642097
- name: run-custom-snappy-tests
20652098
tags:
20662099
- run-custom-dependency-tests
@@ -2974,6 +3007,11 @@ buildvariants:
29743007
- run-typescript-current
29753008
- run-typescript-oldest
29763009
- run-typescript-next
3010+
- name: generate-combined-coverage
3011+
display_name: Generate Combined Coverage
3012+
run_on: rhel80-large
3013+
tasks:
3014+
- download-and-merge-coverage
29773015
- name: mongosh_integration_tests
29783016
display_name: mongosh integration tests
29793017
run_on: ubuntu1804-large

.evergreen/generate_evergreen_tasks.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -501,13 +501,12 @@ BUILD_VARIANTS.push({
501501
]
502502
});
503503

504-
// TODO NODE-3897 - generate combined coverage report
505-
// BUILD_VARIANTS.push({
506-
// name: 'generate-combined-coverage',
507-
// display_name: 'Generate Combined Coverage',
508-
// run_on: DEFAULT_OS,
509-
// tasks: ['download-and-merge-coverage']
510-
// });
504+
BUILD_VARIANTS.push({
505+
name: 'generate-combined-coverage',
506+
display_name: 'Generate Combined Coverage',
507+
run_on: DEFAULT_OS,
508+
tasks: ['download-and-merge-coverage']
509+
});
511510

512511
// singleton build variant for mongosh integration tests
513512
SINGLETON_TASKS.push({
@@ -619,7 +618,6 @@ for (const version of ['5.0', 'rapid', 'latest']) {
619618
}
620619
}
621620

622-
// TODO NODE-3897 - generate combined coverage report
623621
const coverageTask = {
624622
name: 'download and merge coverage'.split(' ').join('-'),
625623
tags: [],
@@ -631,6 +629,7 @@ const coverageTask = {
631629
depends_on: [{ name: '*', variant: '*', status: '*', patch_optional: true }]
632630
};
633631

632+
SINGLETON_TASKS.push(coverageTask);
634633
SINGLETON_TASKS.push(...oneOffFuncAsTasks);
635634

636635
BUILD_VARIANTS.push({

.evergreen/prepare-shell.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ PROJECT_DIRECTORY="$(pwd)"
1111
DRIVERS_TOOLS=$(cd .. && echo "$(pwd)/drivers-tools")
1212
MONGO_ORCHESTRATION_HOME="$DRIVERS_TOOLS/.evergreen/orchestration"
1313
MONGODB_BINARIES="$DRIVERS_TOOLS/mongodb/bin"
14-
UPLOAD_BUCKET="$PROJECT"
14+
UPLOAD_BUCKET="${project}"
1515

1616
if [ "Windows_NT" = "${OS:-notWindows}" ]; then
1717
# fix paths on windows

0 commit comments

Comments
 (0)