From 5f07d0403a1eafeec82eeeca38015f8f6f892761 Mon Sep 17 00:00:00 2001 From: emadum Date: Mon, 26 Oct 2020 18:59:06 -0400 Subject: [PATCH 1/4] test: add xunit output to evergreen config --- .evergreen/config.yml | 6 +++++- .evergreen/config.yml.in | 30 +++++++++++++++++++----------- package.json | 3 ++- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 020ad47ab99..57b4cccc48d 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -207,7 +207,6 @@ functions: params: working_dir: src script: | - ${PREPARE_SHELL} MONGODB_URI='mongodb://mhuser:pencil@localhost' NODE_LTS_NAME='${NODE_LTS_NAME}' \ bash ${PROJECT_DIRECTORY}/.evergreen/run-data-lake-tests.sh run tls tests: @@ -433,12 +432,17 @@ functions: -p 8100 \ -v \ --fault revoked + upload test results: + - command: attach.xunit_results + params: + file: src/xunit.xml pre: - func: fetch source - func: prepare resources - func: fix absolute paths - func: make files executable post: + - func: upload test results - func: cleanup tasks: - name: test-latest-server diff --git a/.evergreen/config.yml.in b/.evergreen/config.yml.in index e452e83d6f3..14b4afd13a0 100644 --- a/.evergreen/config.yml.in +++ b/.evergreen/config.yml.in @@ -103,7 +103,7 @@ functions: params: file: mo-expansion.yml - bootstrap mongohoused: + "bootstrap mongohoused": - command: shell.exec params: script: | @@ -242,7 +242,8 @@ functions: script: | MONGODB_URI='${plain_auth_mongodb_uri}' NODE_LTS_NAME='${NODE_LTS_NAME}' \ bash ${PROJECT_DIRECTORY}/.evergreen/run-ldap-tests.sh - run data lake tests: + + "run data lake tests": - command: shell.exec type: test params: @@ -250,6 +251,7 @@ functions: script: | MONGODB_URI='mongodb://mhuser:pencil@localhost' NODE_LTS_NAME='${NODE_LTS_NAME}' \ bash ${PROJECT_DIRECTORY}/.evergreen/run-data-lake-tests.sh + "run tls tests": - command: shell.exec type: test @@ -286,7 +288,7 @@ functions: } EOF - run aws auth test with regular aws credentials: + "run aws auth test with regular aws credentials": - command: shell.exec type: test params: @@ -315,7 +317,7 @@ functions: ${PREPARE_SHELL} ${PROJECT_DIRECTORY}/.evergreen/run-mongodb-aws-test.sh - run aws auth test with assume role credentials: + "run aws auth test with assume role credentials": - command: shell.exec type: test params: @@ -348,7 +350,7 @@ functions: ${PREPARE_SHELL} ${PROJECT_DIRECTORY}/.evergreen/run-mongodb-aws-test.sh - run aws auth test with aws EC2 credentials: + "run aws auth test with aws EC2 credentials": - command: shell.exec type: test params: @@ -365,7 +367,7 @@ functions: ${PREPARE_SHELL} ${PROJECT_DIRECTORY}/.evergreen/run-mongodb-aws-test.sh - run aws auth test with aws credentials as environment variables: + "run aws auth test with aws credentials as environment variables": - command: shell.exec type: test params: @@ -385,7 +387,7 @@ functions: ${PREPARE_SHELL} ${PROJECT_DIRECTORY}/.evergreen/run-mongodb-aws-test.sh - run aws auth test with aws credentials and session token as environment variables: + "run aws auth test with aws credentials and session token as environment variables": - command: shell.exec type: test params: @@ -406,7 +408,7 @@ functions: ${PREPARE_SHELL} ${PROJECT_DIRECTORY}/.evergreen/run-mongodb-aws-test.sh - run aws ECS auth test: + "run aws ECS auth test": - command: shell.exec type: test params: @@ -433,7 +435,7 @@ functions: cat setup.js mongo --nodb setup.js aws_e2e_ecs.js - run-ocsp-test: + "run-ocsp-test": - command: shell.exec type: test params: @@ -446,7 +448,7 @@ functions: OCSP_TLS_SHOULD_SUCCEED="${OCSP_TLS_SHOULD_SUCCEED}" \ bash ${PROJECT_DIRECTORY}/.evergreen/run-ocsp-tests.sh - run-valid-ocsp-server: + "run-valid-ocsp-server": - command: shell.exec params: script: | @@ -464,7 +466,7 @@ functions: --ocsp_responder_key rsa/ca.key \ -p 8100 -v - run-revoked-ocsp-server: + "run-revoked-ocsp-server": - command: shell.exec params: script: | @@ -484,6 +486,11 @@ functions: -v \ --fault revoked + "upload test results": + # Upload the xunit-format test results. + - command: attach.xunit_results + params: + file: "src/xunit.xml" pre: - func: "fetch source" @@ -493,4 +500,5 @@ pre: - func: "make files executable" post: + - func: "upload test results" - func: "cleanup" diff --git a/package.json b/package.json index 35c0fc8a142..88bf409ff3a 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,7 @@ "sinon": "^4.3.0", "sinon-chai": "^3.2.0", "snappy": "^6.3.0", + "spec-xunit-file": "0.0.1-3", "source-map-support": "^0.5.19", "standard-version": "^7.1.0", "through2": "^3.0.1", @@ -93,7 +94,7 @@ "check:bench": "node test/benchmarks/driverBench", "check:coverage": "nyc npm run check:test", "check:lint": "npm run check:ts && eslint -v && eslint --max-warnings=0 --ext '.js,.ts' src test", - "check:test": "mocha --recursive test/functional test/unit", + "check:test": "mocha --reporter spec-xunit-file --recursive test/functional test/unit", "check:ts": "tsc -v && tsc --noEmit", "check:atlas": "mocha --config \"test/manual/mocharc.json\" test/manual/atlas_connectivity.test.js", "check:adl": "mocha test/manual/data_lake.test.js", From d7fb9211bd0e152c024ff07ec3e98635c187c0d5 Mon Sep 17 00:00:00 2001 From: emadum Date: Mon, 26 Oct 2020 19:30:07 -0400 Subject: [PATCH 2/4] add xunit reporter to other test scripts --- package.json | 2 +- test/manual/mocharc.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 88bf409ff3a..f6111b4e689 100644 --- a/package.json +++ b/package.json @@ -97,7 +97,7 @@ "check:test": "mocha --reporter spec-xunit-file --recursive test/functional test/unit", "check:ts": "tsc -v && tsc --noEmit", "check:atlas": "mocha --config \"test/manual/mocharc.json\" test/manual/atlas_connectivity.test.js", - "check:adl": "mocha test/manual/data_lake.test.js", + "check:adl": "mocha --reporter spec-xunit-file test/manual/data_lake.test.js", "check:ocsp": "mocha --config \"test/manual/mocharc.json\" test/manual/ocsp_support.test.js", "check:kerberos": "mocha --config \"test/manual/mocharc.json\" test/manual/kerberos.test.js", "check:tls": "mocha --config \"test/manual/mocharc.json\" test/manual/tls_support.test.js", diff --git a/test/manual/mocharc.json b/test/manual/mocharc.json index b1ad03e6839..b619df10599 100644 --- a/test/manual/mocharc.json +++ b/test/manual/mocharc.json @@ -1,3 +1,4 @@ { - "require": "ts-node/register" + "require": "ts-node/register", + "reporter": "spec-xunit-file" } \ No newline at end of file From 0e150cc507a59e5aeac953e0686067de2b42da88 Mon Sep 17 00:00:00 2001 From: emadum Date: Tue, 27 Oct 2020 10:26:14 -0400 Subject: [PATCH 3/4] add xunit output file to gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index a20b88e49d5..bfef1ff9daf 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,9 @@ manual_tests/ docs/build docs/Makefile +# xunit test output for CI +xunit.xml + # Directory for dbs db From 4ec02fa7a08d7f07bedacf0605ceaddee630c61e Mon Sep 17 00:00:00 2001 From: emadum Date: Wed, 4 Nov 2020 13:42:34 -0500 Subject: [PATCH 4/4] move reporter to .mocharc.json --- .mocharc.json | 3 ++- package.json | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.mocharc.json b/.mocharc.json index 9deae6d898e..3bbb8ff4019 100644 --- a/.mocharc.json +++ b/.mocharc.json @@ -4,5 +4,6 @@ "file": "test/tools/runner", "ui": "test/tools/runner/metadata_ui.js", "recursive": true, - "timeout": 60000 + "timeout": 60000, + "reporter": "spec-xunit-file" } diff --git a/package.json b/package.json index f6111b4e689..9ddf80835a7 100644 --- a/package.json +++ b/package.json @@ -94,10 +94,10 @@ "check:bench": "node test/benchmarks/driverBench", "check:coverage": "nyc npm run check:test", "check:lint": "npm run check:ts && eslint -v && eslint --max-warnings=0 --ext '.js,.ts' src test", - "check:test": "mocha --reporter spec-xunit-file --recursive test/functional test/unit", + "check:test": "mocha --recursive test/functional test/unit", "check:ts": "tsc -v && tsc --noEmit", "check:atlas": "mocha --config \"test/manual/mocharc.json\" test/manual/atlas_connectivity.test.js", - "check:adl": "mocha --reporter spec-xunit-file test/manual/data_lake.test.js", + "check:adl": "mocha test/manual/data_lake.test.js", "check:ocsp": "mocha --config \"test/manual/mocharc.json\" test/manual/ocsp_support.test.js", "check:kerberos": "mocha --config \"test/manual/mocharc.json\" test/manual/kerberos.test.js", "check:tls": "mocha --config \"test/manual/mocharc.json\" test/manual/tls_support.test.js",