diff --git a/.evergreen/config.in.yml b/.evergreen/config.in.yml index b60a72a9b13..d285d621039 100644 --- a/.evergreen/config.in.yml +++ b/.evergreen/config.in.yml @@ -752,65 +752,6 @@ functions: export PROJECT_DIRECTORY=$ECS_SRC_DIR; python aws_tester.py ecs - "run-ocsp-test": - - command: shell.exec - type: test - params: - working_dir: "src" - script: | - ${PREPARE_SHELL} - - CA_FILE="$DRIVERS_TOOLS/.evergreen/ocsp/rsa/ca.pem" \ - OCSP_TLS_SHOULD_SUCCEED="${OCSP_TLS_SHOULD_SUCCEED}" \ - bash ${PROJECT_DIRECTORY}/.evergreen/run-ocsp-tests.sh - - "run-valid-ocsp-server": - - command: shell.exec - params: - script: | - cd ${DRIVERS_TOOLS}/.evergreen/ocsp - export PYTHON_BINARY=$([ "Windows_NT" = "$OS" ] && echo "/cygdrive/c/python/python38/python.exe" || echo "/opt/mongodbtoolchain/v3/bin/python3") - export PYTHON_VENV_PATH=$([ "Windows_NT" = "$OS" ] && echo "./venv/Scripts" || echo "./venv/bin") - - $PYTHON_BINARY -m venv ./venv - $PYTHON_VENV_PATH/pip3 install -r ${DRIVERS_TOOLS}/.evergreen/ocsp/mock-ocsp-responder-requirements.txt - - - command: shell.exec - params: - background: true - script: | - cd ${DRIVERS_TOOLS}/.evergreen/ocsp - nohup $PYTHON_VENV_PATH/python3 ocsp_mock.py \ - --ca_file rsa/ca.pem \ - --ocsp_responder_cert rsa/ca.crt \ - --ocsp_responder_key rsa/ca.key \ - -p 8100 -v - - "run-revoked-ocsp-server": - - command: shell.exec - params: - script: | - cd ${DRIVERS_TOOLS}/.evergreen/ocsp - - export PYTHON_BINARY=$([ "Windows_NT" = "$OS" ] && echo "/cygdrive/c/python/python38/python.exe" || echo "/opt/mongodbtoolchain/v3/bin/python3") - export PYTHON_VENV_PATH=$([ "Windows_NT" = "$OS" ] && echo "./venv/Scripts" || echo "./venv/bin") - - $PYTHON_BINARY -m venv ./venv - $PYTHON_VENV_PATH/pip3 install -r ${DRIVERS_TOOLS}/.evergreen/ocsp/mock-ocsp-responder-requirements.txt - - - command: shell.exec - params: - background: true - script: | - cd ${DRIVERS_TOOLS}/.evergreen/ocsp - nohup $PYTHON_VENV_PATH/python3 ocsp_mock.py \ - --ca_file rsa/ca.pem \ - --ocsp_responder_cert rsa/ca.crt \ - --ocsp_responder_key rsa/ca.key \ - -p 8100 \ - -v \ - --fault revoked - "run custom csfle tests": - command: ec2.assume_role params: diff --git a/.evergreen/config.yml b/.evergreen/config.yml index ac7b533a873..943e15332e9 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -705,70 +705,6 @@ functions: export PROJECT_DIRECTORY=$ECS_SRC_DIR; python aws_tester.py ecs - run-ocsp-test: - - command: shell.exec - type: test - params: - working_dir: src - script: | - ${PREPARE_SHELL} - - CA_FILE="$DRIVERS_TOOLS/.evergreen/ocsp/rsa/ca.pem" \ - OCSP_TLS_SHOULD_SUCCEED="${OCSP_TLS_SHOULD_SUCCEED}" \ - bash ${PROJECT_DIRECTORY}/.evergreen/run-ocsp-tests.sh - run-valid-ocsp-server: - - command: shell.exec - params: - script: > - cd ${DRIVERS_TOOLS}/.evergreen/ocsp - - export PYTHON_BINARY=$([ "Windows_NT" = "$OS" ] && echo "/cygdrive/c/python/python38/python.exe" || echo - "/opt/mongodbtoolchain/v3/bin/python3") - - export PYTHON_VENV_PATH=$([ "Windows_NT" = "$OS" ] && echo "./venv/Scripts" || echo "./venv/bin") - - - $PYTHON_BINARY -m venv ./venv - - $PYTHON_VENV_PATH/pip3 install -r ${DRIVERS_TOOLS}/.evergreen/ocsp/mock-ocsp-responder-requirements.txt - - command: shell.exec - params: - background: true - script: | - cd ${DRIVERS_TOOLS}/.evergreen/ocsp - nohup $PYTHON_VENV_PATH/python3 ocsp_mock.py \ - --ca_file rsa/ca.pem \ - --ocsp_responder_cert rsa/ca.crt \ - --ocsp_responder_key rsa/ca.key \ - -p 8100 -v - run-revoked-ocsp-server: - - command: shell.exec - params: - script: > - cd ${DRIVERS_TOOLS}/.evergreen/ocsp - - - export PYTHON_BINARY=$([ "Windows_NT" = "$OS" ] && echo "/cygdrive/c/python/python38/python.exe" || echo - "/opt/mongodbtoolchain/v3/bin/python3") - - export PYTHON_VENV_PATH=$([ "Windows_NT" = "$OS" ] && echo "./venv/Scripts" || echo "./venv/bin") - - - $PYTHON_BINARY -m venv ./venv - - $PYTHON_VENV_PATH/pip3 install -r ${DRIVERS_TOOLS}/.evergreen/ocsp/mock-ocsp-responder-requirements.txt - - command: shell.exec - params: - background: true - script: | - cd ${DRIVERS_TOOLS}/.evergreen/ocsp - nohup $PYTHON_VENV_PATH/python3 ocsp_mock.py \ - --ca_file rsa/ca.pem \ - --ocsp_responder_cert rsa/ca.crt \ - --ocsp_responder_key rsa/ca.key \ - -p 8100 \ - -v \ - --fault revoked run custom csfle tests: - command: ec2.assume_role params: diff --git a/.evergreen/run-ocsp-tests.sh b/.evergreen/run-ocsp-tests.sh deleted file mode 100644 index 824d5ea4309..00000000000 --- a/.evergreen/run-ocsp-tests.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash -set -o xtrace -set -o errexit - -# load node.js environment -source $DRIVERS_TOOLS/.evergreen/init-node-and-npm-env.sh - -# $PYTHON_BINARY -m virtualenv --never-download --no-wheel ocsptest -# . ocsptest/bin/activate -# trap "deactivate; rm -rf ocsptest" EXIT HUP -# pip install pyopenssl requests service_identity -# PYTHON=python - -# NOTE: `--opts {}` is used below to revert mocha to normal behavior (without mongodb specific plugins) -export OCSP_TLS_SHOULD_SUCCEED=${OCSP_TLS_SHOULD_SUCCEED} -export CA_FILE=${CA_FILE} -npm run check:ocsp diff --git a/package.json b/package.json index fa4b74cb01f..34f099aa738 100644 --- a/package.json +++ b/package.json @@ -152,7 +152,6 @@ "check:oidc-azure": "mocha --config test/mocha_mongodb.json test/integration/auth/mongodb_oidc_azure.prose.05.test.ts", "check:oidc-gcp": "mocha --config test/mocha_mongodb.json test/integration/auth/mongodb_oidc_gcp.prose.06.test.ts", "check:oidc-k8s": "mocha --config test/mocha_mongodb.json test/integration/auth/mongodb_oidc_k8s.prose.07.test.ts", - "check:ocsp": "mocha --config test/manual/mocharc.json test/manual/ocsp_support.test.js", "check:kerberos": "nyc mocha --config test/manual/mocharc.json test/manual/kerberos.test.ts", "check:tls": "mocha --config test/manual/mocharc.json test/manual/tls_support.test.ts", "check:ldap": "nyc mocha --config test/manual/mocharc.json test/manual/ldap.test.js", diff --git a/test/manual/ocsp_support.test.js b/test/manual/ocsp_support.test.js deleted file mode 100644 index 58fbb603e26..00000000000 --- a/test/manual/ocsp_support.test.js +++ /dev/null @@ -1,54 +0,0 @@ -'use strict'; - -const MongoClient = require('../mongodb').MongoClient; -const expect = require('chai').expect; -const { LEGACY_HELLO_COMMAND } = require('../mongodb'); - -const OCSP_TLS_SHOULD_SUCCEED = process.env.OCSP_TLS_SHOULD_SUCCEED; -const CA_FILE = process.env.CA_FILE; - -// NOTE: this file is NOT run through the normal test runner -describe('OCSP Support', function () { - before(function () { - if (OCSP_TLS_SHOULD_SUCCEED == null || CA_FILE == null) { - this.skip(); - } - }); - - function connect(options, done) { - const client = new MongoClient( - `mongodb://localhost:27017/?serverSelectionTimeoutMS=500&tlsCAFile=${CA_FILE}&${options}` - ); - - client.connect(err => { - if (err) return done(err); - - client.db('admin').command({ [LEGACY_HELLO_COMMAND]: 1 }, err => { - client.close(err2 => done(err || err2)); - }); - }); - } - - it('should support OCSP with tlsInsecure', function (done) { - // should always succeed - connect('tls=true&tlsInsecure=true', done); - }); - - it('should support OCSP with tlsAllowInvalidCertificates', function (done) { - // should always succeed - connect('tls=true&tlsAllowInvalidCertificates=true', done); - }); - - it('should support OCSP with `tls=true`', function (done) { - connect('tls=true', err => { - if (OCSP_TLS_SHOULD_SUCCEED) { - expect(err).to.not.exist; - return done(); - } - - expect(err).to.exist; - expect(err).to.match(/invalid status response/); - done(); - }); - }); -}); diff --git a/test/readme.md b/test/readme.md index 81c2068bd2b..5e5f903a74f 100644 --- a/test/readme.md +++ b/test/readme.md @@ -53,16 +53,16 @@ tests will be skipped. Below is a summary of the types of test automation in this repo. -| Type of Test | Test Location | About the Tests | How to Run Tests | -| ---------------------------- | ------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Unit | `/test/unit` | The unit tests test individual pieces of code, typically functions. These tests do **not** interact with a real database, so mocks are used instead.

The unit test directory mirrors the `/src` directory structure with test file names matching the source file names of the code they test. | `npm run check:unit` | -| Integration | `/test/integration` | The integration tests test that a given feature or piece of a feature is working as expected. These tests do **not** use mocks; instead, they interact with a real database.

The integration test directory follows the `test/spec` directory structure representing the different functional areas of the driver.

**Note:** The `.gitkeep` files are intentionally left to ensure that this directory structure is preserved even as the actual test files are moved around. | `npm run check:test` | -| Benchmark | `/test/benchmarks` | The benchmark tests report how long a designated set of tests take to run. They are used to measure performance. | `npm run check:bench` | -| Specialized Environment | `/test/manual` | The specalized environment tests are functional tests that require specialized environment setups in Evergreen.

**Note**: "manual" in the directory path does not refer to tests that should be run manually. These tests are automated. These tests have a special Evergreen configuration and run in isolation from the other tests. | There is no single script for running all of the specialized environment tests. Instead, you can run the appropriate script based on the specialized environment you want to use:
- `npm run check:atlas` to test Atlas
- `npm run check:adl` to test Atlas Data Lake
- `npm run check:ocsp` to test OCSP
- `npm run check:kerberos` to test Kerberos
- `npm run check:tls` to test TLS
- `npm run check:ldap` to test LDAP authorization | -| TypeScript Definition | `/test/types` | The TypeScript definition tests verify the type definitions are correct. | `npm run check:tsd` | -| GitHub Actions | `/test/action` | Tests that run as GitHub Actions such as dependency checking. | Currently, only `npm run check:dependencies` but could be expanded to more in the future. | -| Code Examples | `/test/integration/node-specific/examples` | Code examples that are also paired with tests that show they are working examples. | Currently, `npm run check:lambda` to test the AWS Lambda example with default auth and `npm run check:lambda:aws` to test the AWS Lambda example with AWS auth. | -| Explicit Resource Management | `/test/explicit-resource-management` | Tests that use explicit resource management with the driver's disposable resources. | `bash .evergreen/run-resource-management-feature-integration.sh` | +| Type of Test | Test Location | About the Tests | How to Run Tests | +| ---------------------------- | ------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Unit | `/test/unit` | The unit tests test individual pieces of code, typically functions. These tests do **not** interact with a real database, so mocks are used instead.

The unit test directory mirrors the `/src` directory structure with test file names matching the source file names of the code they test. | `npm run check:unit` | +| Integration | `/test/integration` | The integration tests test that a given feature or piece of a feature is working as expected. These tests do **not** use mocks; instead, they interact with a real database.

The integration test directory follows the `test/spec` directory structure representing the different functional areas of the driver.

**Note:** The `.gitkeep` files are intentionally left to ensure that this directory structure is preserved even as the actual test files are moved around. | `npm run check:test` | +| Benchmark | `/test/benchmarks` | The benchmark tests report how long a designated set of tests take to run. They are used to measure performance. | `npm run check:bench` | +| Specialized Environment | `/test/manual` | The specalized environment tests are functional tests that require specialized environment setups in Evergreen.

**Note**: "manual" in the directory path does not refer to tests that should be run manually. These tests are automated. These tests have a special Evergreen configuration and run in isolation from the other tests. | There is no single script for running all of the specialized environment tests. Instead, you can run the appropriate script based on the specialized environment you want to use:
- `npm run check:atlas` to test Atlas
- `npm run check:adl` to test Atlas Data Lake
- `npm run check:kerberos` to test Kerberos
- `npm run check:tls` to test TLS
- `npm run check:ldap` to test LDAP authorization | +| TypeScript Definition | `/test/types` | The TypeScript definition tests verify the type definitions are correct. | `npm run check:tsd` | +| GitHub Actions | `/test/action` | Tests that run as GitHub Actions such as dependency checking. | Currently, only `npm run check:dependencies` but could be expanded to more in the future. | +| Code Examples | `/test/integration/node-specific/examples` | Code examples that are also paired with tests that show they are working examples. | Currently, `npm run check:lambda` to test the AWS Lambda example with default auth and `npm run check:lambda:aws` to test the AWS Lambda example with AWS auth. | +| Explicit Resource Management | `/test/explicit-resource-management` | Tests that use explicit resource management with the driver's disposable resources. | `bash .evergreen/run-resource-management-feature-integration.sh` | ### Spec Tests @@ -618,7 +618,6 @@ TODO(NODE-6698): Update deployed lambda test section. - Kerberos - AWS Authentication -- OCSP - TLS - Atlas Data Lake - LDAP diff --git a/test/tools/runner/hooks/configuration.ts b/test/tools/runner/hooks/configuration.ts index 063c6453dbd..959c62d1325 100644 --- a/test/tools/runner/hooks/configuration.ts +++ b/test/tools/runner/hooks/configuration.ts @@ -188,7 +188,6 @@ const testConfigBeforeHook = async function () { : false, kerberos: process.env.KRB5_PRINCIPAL != null, ldap: MONGODB_URI.includes('authMechanism=PLAIN'), - ocsp: process.env.OCSP_TLS_SHOULD_SUCCEED != null && process.env.CA_FILE != null, socks5: MONGODB_URI.includes('proxyHost='), compressor: process.env.COMPRESSOR, cryptSharedLibPath: process.env.CRYPT_SHARED_LIB_PATH,