From dc005ceb1415b70472194154bd7af1f67243364b Mon Sep 17 00:00:00 2001 From: Durran Jordan Date: Tue, 15 Apr 2025 16:24:01 +0200 Subject: [PATCH 1/4] test(NODE-6891): add coverage for all test runs --- .evergreen/config.in.yml | 11 +++++++++++ .evergreen/config.yml | 11 +++++++++++ package.json | 34 +++++++++++++++++----------------- 3 files changed, 39 insertions(+), 17 deletions(-) diff --git a/.evergreen/config.in.yml b/.evergreen/config.in.yml index a35a16a103..2fafe34f63 100644 --- a/.evergreen/config.in.yml +++ b/.evergreen/config.in.yml @@ -1066,6 +1066,7 @@ task_groups: binary: bash args: - ${DRIVERS_TOOLS}/.evergreen/csfle/gcpkms/teardown.sh + - func: "upload coverage report" tasks: - test-gcpkms-task @@ -1093,6 +1094,7 @@ task_groups: binary: bash args: - ${DRIVERS_TOOLS}/.evergreen/csfle/azurekms/teardown.sh + - func: "upload coverage report" tasks: - test-azurekms-task @@ -1113,6 +1115,7 @@ task_groups: binary: bash args: - ${DRIVERS_TOOLS}/.evergreen/auth_oidc/k8s/teardown.sh + - func: "upload coverage report" setup_group_can_fail_task: true setup_group_timeout_secs: 1800 tasks: @@ -1135,6 +1138,7 @@ task_groups: binary: bash args: - ${DRIVERS_TOOLS}/.evergreen/auth_oidc/k8s/teardown.sh + - func: "upload coverage report" setup_group_can_fail_task: true setup_group_timeout_secs: 1800 tasks: @@ -1157,6 +1161,7 @@ task_groups: binary: bash args: - ${DRIVERS_TOOLS}/.evergreen/auth_oidc/k8s/teardown.sh + - func: "upload coverage report" setup_group_can_fail_task: true setup_group_timeout_secs: 1800 tasks: @@ -1177,6 +1182,8 @@ task_groups: MONGODB_VERSION: "8.0" args: - ${DRIVERS_TOOLS}/.evergreen/auth_oidc/setup.sh + teardown_task: + - func: "upload coverage report" setup_group_can_fail_task: true setup_group_timeout_secs: 1800 tasks: @@ -1200,6 +1207,7 @@ task_groups: script: |- ${PREPARE_SHELL} $DRIVERS_TOOLS/.evergreen/auth_oidc/azure/teardown.sh + - func: "upload coverage report" setup_group_can_fail_task: true setup_group_timeout_secs: 1800 tasks: @@ -1223,6 +1231,7 @@ task_groups: script: |- ${PREPARE_SHELL} $DRIVERS_TOOLS/.evergreen/auth_oidc/gcp/teardown.sh + - func: "upload coverage report" setup_group_can_fail_task: true setup_group_timeout_secs: 1800 tasks: @@ -1252,6 +1261,7 @@ task_groups: binary: bash args: - ${DRIVERS_TOOLS}/.evergreen/atlas/teardown-atlas-cluster.sh + - func: "upload coverage report" setup_group_can_fail_task: true setup_group_timeout_secs: 1800 tasks: @@ -1279,6 +1289,7 @@ task_groups: binary: bash args: - ${DRIVERS_TOOLS}/.evergreen/atlas/teardown-atlas-cluster.sh + - func: "upload coverage report" setup_group_can_fail_task: true setup_group_timeout_secs: 1800 tasks: diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 0724b65f06..1ee8ee3921 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -2926,6 +2926,7 @@ task_groups: binary: bash args: - ${DRIVERS_TOOLS}/.evergreen/csfle/gcpkms/teardown.sh + - func: upload coverage report tasks: - test-gcpkms-task - name: test_azurekms_task_group @@ -2950,6 +2951,7 @@ task_groups: binary: bash args: - ${DRIVERS_TOOLS}/.evergreen/csfle/azurekms/teardown.sh + - func: upload coverage report tasks: - test-azurekms-task - name: testk8soidc_task_group_eks @@ -2969,6 +2971,7 @@ task_groups: binary: bash args: - ${DRIVERS_TOOLS}/.evergreen/auth_oidc/k8s/teardown.sh + - func: upload coverage report setup_group_can_fail_task: true setup_group_timeout_secs: 1800 tasks: @@ -2990,6 +2993,7 @@ task_groups: binary: bash args: - ${DRIVERS_TOOLS}/.evergreen/auth_oidc/k8s/teardown.sh + - func: upload coverage report setup_group_can_fail_task: true setup_group_timeout_secs: 1800 tasks: @@ -3011,6 +3015,7 @@ task_groups: binary: bash args: - ${DRIVERS_TOOLS}/.evergreen/auth_oidc/k8s/teardown.sh + - func: upload coverage report setup_group_can_fail_task: true setup_group_timeout_secs: 1800 tasks: @@ -3032,6 +3037,8 @@ task_groups: MONGODB_VERSION: '8.0' args: - ${DRIVERS_TOOLS}/.evergreen/auth_oidc/setup.sh + teardown_task: + - func: upload coverage report setup_group_can_fail_task: true setup_group_timeout_secs: 1800 tasks: @@ -3054,6 +3061,7 @@ task_groups: script: |- ${PREPARE_SHELL} $DRIVERS_TOOLS/.evergreen/auth_oidc/azure/teardown.sh + - func: upload coverage report setup_group_can_fail_task: true setup_group_timeout_secs: 1800 tasks: @@ -3076,6 +3084,7 @@ task_groups: script: |- ${PREPARE_SHELL} $DRIVERS_TOOLS/.evergreen/auth_oidc/gcp/teardown.sh + - func: upload coverage report setup_group_can_fail_task: true setup_group_timeout_secs: 1800 tasks: @@ -3104,6 +3113,7 @@ task_groups: binary: bash args: - ${DRIVERS_TOOLS}/.evergreen/atlas/teardown-atlas-cluster.sh + - func: upload coverage report setup_group_can_fail_task: true setup_group_timeout_secs: 1800 tasks: @@ -3130,6 +3140,7 @@ task_groups: binary: bash args: - ${DRIVERS_TOOLS}/.evergreen/atlas/teardown-atlas-cluster.sh + - func: upload coverage report setup_group_can_fail_task: true setup_group_timeout_secs: 1800 tasks: diff --git a/package.json b/package.json index 3892967023..f3c4583298 100644 --- a/package.json +++ b/package.json @@ -131,8 +131,8 @@ "check:bench": "npm --prefix test/benchmarks/driver_bench start", "check:coverage": "nyc npm run test:all", "check:integration-coverage": "nyc npm run check:test", - "check:lambda": "mocha --config test/mocha_lambda.js test/integration/node-specific/examples/handler.test.js", - "check:lambda:aws": "mocha --config test/mocha_lambda.js test/integration/node-specific/examples/aws_handler.test.js", + "check:lambda": "nyc mocha --config test/mocha_lambda.js test/integration/node-specific/examples/handler.test.js", + "check:lambda:aws": "nyc mocha --config test/mocha_lambda.js test/integration/node-specific/examples/aws_handler.test.js", "check:lint": "npm run build:dts && npm run check:dts && npm run check:eslint && npm run check:tsd", "check:eslint": "npm run build:dts && ESLINT_USE_FLAT_CONFIG=false eslint -v && ESLINT_USE_FLAT_CONFIG=false eslint --max-warnings=0 --ext '.js,.ts' src test", "check:tsd": "tsd --version && tsd", @@ -140,25 +140,25 @@ "check:dts": "node ./node_modules/typescript/bin/tsc --noEmit mongodb.d.ts && tsd", "check:search-indexes": "nyc mocha --config test/mocha_mongodb.js test/manual/search-index-management.prose.test.ts", "check:test": "mocha --config test/mocha_mongodb.js test/integration", - "check:unit": "mocha test/unit", + "check:unit": "nyc mocha test/unit", "check:ts": "node ./node_modules/typescript/bin/tsc -v && node ./node_modules/typescript/bin/tsc --noEmit", - "check:atlas": "mocha --config test/manual/mocharc.js test/manual/atlas_connectivity.test.ts", - "check:resource-management": "mocha --config test/manual/mocharc.js test/manual/resource_management.test.ts", - "check:drivers-atlas-testing": "mocha --config test/mocha_mongodb.js test/atlas/drivers_atlas_testing.test.ts", - "check:adl": "mocha --config test/mocha_mongodb.js test/manual/atlas-data-lake-testing", + "check:atlas": "nyc mocha --config test/manual/mocharc.js test/manual/atlas_connectivity.test.ts", + "check:resource-management": "nyc mocha --config test/manual/mocharc.js test/manual/resource_management.test.ts", + "check:drivers-atlas-testing": "nyc mocha --config test/mocha_mongodb.js test/atlas/drivers_atlas_testing.test.ts", + "check:adl": "nyc mocha --config test/mocha_mongodb.js test/manual/atlas-data-lake-testing", "check:aws": "nyc mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_aws.test.ts", - "check:oidc-auth": "mocha --config test/mocha_mongodb.js test/integration/auth/auth.spec.test.ts", - "check:oidc-test": "mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_oidc.prose.test.ts", - "check:oidc-azure": "mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_oidc_azure.prose.05.test.ts", - "check:oidc-gcp": "mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_oidc_gcp.prose.06.test.ts", - "check:oidc-k8s": "mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_oidc_k8s.prose.07.test.ts", + "check:oidc-auth": "nyc mocha --config test/mocha_mongodb.js test/integration/auth/auth.spec.test.ts", + "check:oidc-test": "nyc mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_oidc.prose.test.ts", + "check:oidc-azure": "nyc mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_oidc_azure.prose.05.test.ts", + "check:oidc-gcp": "nyc mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_oidc_gcp.prose.06.test.ts", + "check:oidc-k8s": "nyc mocha --config test/mocha_mongodb.js test/integration/auth/mongodb_oidc_k8s.prose.07.test.ts", "check:kerberos": "nyc mocha --config test/manual/mocharc.js test/manual/kerberos.test.ts", - "check:tls": "mocha --config test/manual/mocharc.js test/manual/tls_support.test.ts", + "check:tls": "nyc mocha --config test/manual/mocharc.js test/manual/tls_support.test.ts", "check:ldap": "nyc mocha --config test/manual/mocharc.js test/manual/ldap.test.ts", - "check:socks5": "mocha --config test/manual/mocharc.js test/manual/socks5.test.ts", - "check:csfle": "mocha --config test/mocha_mongodb.js test/integration/client-side-encryption", - "check:snappy": "mocha test/unit/assorted/snappy.test.js", - "check:x509": "mocha test/manual/x509_auth.test.ts", + "check:socks5": "nyc mocha --config test/manual/mocharc.js test/manual/socks5.test.ts", + "check:csfle": "nyc mocha --config test/mocha_mongodb.js test/integration/client-side-encryption", + "check:snappy": "nyc mocha test/unit/assorted/snappy.test.js", + "check:x509": "nyc mocha test/manual/x509_auth.test.ts", "fix:eslint": "npm run check:eslint -- --fix", "prepare": "node etc/prepare.js", "preview:docs": "ts-node etc/docs/preview.ts", From 54552b26cb82acc465c74437209c71fa62e98a33 Mon Sep 17 00:00:00 2001 From: Durran Jordan Date: Tue, 15 Apr 2025 21:45:12 +0200 Subject: [PATCH 2/4] test: update task to group --- .evergreen/config.in.yml | 14 +++++++------- .evergreen/config.yml | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.evergreen/config.in.yml b/.evergreen/config.in.yml index 2fafe34f63..c8a050d18c 100644 --- a/.evergreen/config.in.yml +++ b/.evergreen/config.in.yml @@ -1109,7 +1109,7 @@ task_groups: binary: bash args: - ${DRIVERS_TOOLS}/.evergreen/auth_oidc/k8s/setup.sh - teardown_task: + teardown_group: - command: subprocess.exec params: binary: bash @@ -1132,7 +1132,7 @@ task_groups: binary: bash args: - ${DRIVERS_TOOLS}/.evergreen/auth_oidc/k8s/setup.sh - teardown_task: + teardown_group: - command: subprocess.exec params: binary: bash @@ -1155,7 +1155,7 @@ task_groups: binary: bash args: - ${DRIVERS_TOOLS}/.evergreen/auth_oidc/k8s/setup.sh - teardown_task: + teardown_group: - command: subprocess.exec params: binary: bash @@ -1200,7 +1200,7 @@ task_groups: ${PREPARE_SHELL} export AZUREOIDC_VMNAME_PREFIX="NODE_DRIVER" $DRIVERS_TOOLS/.evergreen/auth_oidc/azure/setup.sh - teardown_task: + teardown_group: - command: shell.exec params: shell: bash @@ -1224,7 +1224,7 @@ task_groups: ${PREPARE_SHELL} export GCPOIDC_VMNAME_PREFIX="NODE_DRIVER" $DRIVERS_TOOLS/.evergreen/auth_oidc/gcp/setup.sh - teardown_task: + teardown_group: - command: shell.exec params: shell: bash @@ -1254,7 +1254,7 @@ task_groups: - command: expansions.update params: file: src/atlas-expansion.yml - teardown_task: + teardown_group: - command: subprocess.exec params: working_dir: src @@ -1282,7 +1282,7 @@ task_groups: - command: expansions.update params: file: src/atlas-expansion.yml - teardown_task: + teardown_group: - command: subprocess.exec params: working_dir: src diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 1ee8ee3921..3bfabdb120 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -2965,7 +2965,7 @@ task_groups: binary: bash args: - ${DRIVERS_TOOLS}/.evergreen/auth_oidc/k8s/setup.sh - teardown_task: + teardown_group: - command: subprocess.exec params: binary: bash @@ -2987,7 +2987,7 @@ task_groups: binary: bash args: - ${DRIVERS_TOOLS}/.evergreen/auth_oidc/k8s/setup.sh - teardown_task: + teardown_group: - command: subprocess.exec params: binary: bash @@ -3009,7 +3009,7 @@ task_groups: binary: bash args: - ${DRIVERS_TOOLS}/.evergreen/auth_oidc/k8s/setup.sh - teardown_task: + teardown_group: - command: subprocess.exec params: binary: bash @@ -3054,7 +3054,7 @@ task_groups: ${PREPARE_SHELL} export AZUREOIDC_VMNAME_PREFIX="NODE_DRIVER" $DRIVERS_TOOLS/.evergreen/auth_oidc/azure/setup.sh - teardown_task: + teardown_group: - command: shell.exec params: shell: bash @@ -3077,7 +3077,7 @@ task_groups: ${PREPARE_SHELL} export GCPOIDC_VMNAME_PREFIX="NODE_DRIVER" $DRIVERS_TOOLS/.evergreen/auth_oidc/gcp/setup.sh - teardown_task: + teardown_group: - command: shell.exec params: shell: bash @@ -3106,7 +3106,7 @@ task_groups: - command: expansions.update params: file: src/atlas-expansion.yml - teardown_task: + teardown_group: - command: subprocess.exec params: working_dir: src @@ -3133,7 +3133,7 @@ task_groups: - command: expansions.update params: file: src/atlas-expansion.yml - teardown_task: + teardown_group: - command: subprocess.exec params: working_dir: src From 5110e7aa30ee01abdef99dafdff10577529fc52a Mon Sep 17 00:00:00 2001 From: Durran Jordan Date: Tue, 15 Apr 2025 22:41:02 +0200 Subject: [PATCH 3/4] test: reorder teardown --- .evergreen/config.in.yml | 6 +++--- .evergreen/config.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.evergreen/config.in.yml b/.evergreen/config.in.yml index c8a050d18c..06bbfabd01 100644 --- a/.evergreen/config.in.yml +++ b/.evergreen/config.in.yml @@ -1110,12 +1110,12 @@ task_groups: args: - ${DRIVERS_TOOLS}/.evergreen/auth_oidc/k8s/setup.sh teardown_group: + - func: "upload coverage report" - command: subprocess.exec params: binary: bash args: - ${DRIVERS_TOOLS}/.evergreen/auth_oidc/k8s/teardown.sh - - func: "upload coverage report" setup_group_can_fail_task: true setup_group_timeout_secs: 1800 tasks: @@ -1133,12 +1133,12 @@ task_groups: args: - ${DRIVERS_TOOLS}/.evergreen/auth_oidc/k8s/setup.sh teardown_group: + - func: "upload coverage report" - command: subprocess.exec params: binary: bash args: - ${DRIVERS_TOOLS}/.evergreen/auth_oidc/k8s/teardown.sh - - func: "upload coverage report" setup_group_can_fail_task: true setup_group_timeout_secs: 1800 tasks: @@ -1156,12 +1156,12 @@ task_groups: args: - ${DRIVERS_TOOLS}/.evergreen/auth_oidc/k8s/setup.sh teardown_group: + - func: "upload coverage report" - command: subprocess.exec params: binary: bash args: - ${DRIVERS_TOOLS}/.evergreen/auth_oidc/k8s/teardown.sh - - func: "upload coverage report" setup_group_can_fail_task: true setup_group_timeout_secs: 1800 tasks: diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 3bfabdb120..0287df90ec 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -2966,12 +2966,12 @@ task_groups: args: - ${DRIVERS_TOOLS}/.evergreen/auth_oidc/k8s/setup.sh teardown_group: + - func: upload coverage report - command: subprocess.exec params: binary: bash args: - ${DRIVERS_TOOLS}/.evergreen/auth_oidc/k8s/teardown.sh - - func: upload coverage report setup_group_can_fail_task: true setup_group_timeout_secs: 1800 tasks: @@ -2988,12 +2988,12 @@ task_groups: args: - ${DRIVERS_TOOLS}/.evergreen/auth_oidc/k8s/setup.sh teardown_group: + - func: upload coverage report - command: subprocess.exec params: binary: bash args: - ${DRIVERS_TOOLS}/.evergreen/auth_oidc/k8s/teardown.sh - - func: upload coverage report setup_group_can_fail_task: true setup_group_timeout_secs: 1800 tasks: @@ -3010,12 +3010,12 @@ task_groups: args: - ${DRIVERS_TOOLS}/.evergreen/auth_oidc/k8s/setup.sh teardown_group: + - func: upload coverage report - command: subprocess.exec params: binary: bash args: - ${DRIVERS_TOOLS}/.evergreen/auth_oidc/k8s/teardown.sh - - func: upload coverage report setup_group_can_fail_task: true setup_group_timeout_secs: 1800 tasks: From 701acc141df5b064a74a9aa4a444319b6b767517 Mon Sep 17 00:00:00 2001 From: Durran Jordan Date: Wed, 16 Apr 2025 20:13:25 +0200 Subject: [PATCH 4/4] test: remove excludes --- .evergreen/config.in.yml | 4 +--- .evergreen/config.yml | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.evergreen/config.in.yml b/.evergreen/config.in.yml index 06bbfabd01..e1977a6873 100644 --- a/.evergreen/config.in.yml +++ b/.evergreen/config.in.yml @@ -674,9 +674,7 @@ functions: # compression tests. aws s3 cp --recursive s3://mciuploads/mongo-node-driver/${revision}/${version_id}/ \ coverage/ \ - --exclude "results.*.json" \ - --exclude "*rhel80-large*" \ - --include "*fermiun" + --exclude "results.*.json" # npx does not recognize the dependency so install it directly. npm install @istanbuljs/nyc-config-typescript diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 0287df90ec..c13ae8910c 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -600,9 +600,7 @@ functions: # compression tests. aws s3 cp --recursive s3://mciuploads/mongo-node-driver/${revision}/${version_id}/ \ coverage/ \ - --exclude "results.*.json" \ - --exclude "*rhel80-large*" \ - --include "*fermiun" + --exclude "results.*.json" # npx does not recognize the dependency so install it directly. npm install @istanbuljs/nyc-config-typescript