From e5e3c93611fed807377db943996a6242ab6b696b Mon Sep 17 00:00:00 2001 From: Durran Jordan Date: Wed, 31 May 2023 14:08:17 -0400 Subject: [PATCH] test(NODE-5317): use new evergreen scripts (#3669) Co-authored-by: Bailey Pearson --- .evergreen/config.in.yml | 47 +++++++++++++---------- .evergreen/config.yml | 47 +++++++++++++---------- .evergreen/run-orchestration.sh | 3 ++ test/integration/auth/mongodb_aws.test.ts | 15 -------- 4 files changed, 57 insertions(+), 55 deletions(-) diff --git a/.evergreen/config.in.yml b/.evergreen/config.in.yml index df9142ffa8..36c567727e 100644 --- a/.evergreen/config.in.yml +++ b/.evergreen/config.in.yml @@ -675,9 +675,10 @@ functions: shell: bash script: | ${PREPARE_SHELL} + set -ex cd ${DRIVERS_TOOLS}/.evergreen/auth_aws . ./activate-authawsvenv.sh - ${MONGODB_BINARIES}/mongo aws_e2e_regular_aws.js + python aws_tester.py regular - command: shell.exec type: test params: @@ -706,9 +707,10 @@ functions: shell: bash script: | ${PREPARE_SHELL} + set -ex cd ${DRIVERS_TOOLS}/.evergreen/auth_aws . ./activate-authawsvenv.sh - ${MONGODB_BINARIES}/mongo aws_e2e_assume_role.js + python aws_tester.py assume-role - command: shell.exec type: test params: @@ -744,9 +746,10 @@ functions: # Write an empty prepare_mongodb_aws so no auth environment variables # are set. echo "" > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh" + set -ex cd ${DRIVERS_TOOLS}/.evergreen/auth_aws . ./activate-authawsvenv.sh - ${MONGODB_BINARIES}/mongo aws_e2e_ec2.js + python aws_tester.py ec2 - command: shell.exec type: test params: @@ -762,9 +765,12 @@ functions: params: working_dir: "src" silent: true + shell: bash script: | + set -ex cd ${DRIVERS_TOOLS}/.evergreen/auth_aws - ${MONGODB_BINARIES}/mongo --verbose aws_e2e_regular_aws.js + . ./activate-authawsvenv.sh + python aws_tester.py regular cd - cat < "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh" export AWS_ACCESS_KEY_ID=${iam_auth_ecs_account} @@ -785,9 +791,12 @@ functions: params: working_dir: "src" silent: true + shell: bash script: | + set -ex cd ${DRIVERS_TOOLS}/.evergreen/auth_aws - ${MONGODB_BINARIES}/mongo --verbose aws_e2e_assume_role.js + . ./activate-authawsvenv.sh + python aws_tester.py assume-role cd - cat <<'EOF' > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh" export AWS_ACCESS_KEY_ID=$(jq -r '.AccessKeyId' ${DRIVERS_TOOLS}/.evergreen/auth_aws/creds.json) @@ -809,10 +818,12 @@ functions: params: working_dir: "src" silent: true + shell: bash script: | + set -ex cd ${DRIVERS_TOOLS}/.evergreen/auth_aws - . ./activate_venv.sh - ${MONGODB_BINARIES}/mongo --verbose aws_e2e_web_identity.js + . ./activate-authawsvenv.sh + python aws_tester.py web-identity cd - cat <<'EOF' > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh" export AWS_WEB_IDENTITY_TOKEN_FILE=${iam_web_identity_token_file} @@ -834,10 +845,12 @@ functions: params: working_dir: "src" silent: true + shell: bash script: | + set -ex cd ${DRIVERS_TOOLS}/.evergreen/auth_aws - . ./activate_venv.sh - ${MONGODB_BINARIES}/mongo --verbose aws_e2e_web_identity.js + . ./activate-authawsvenv.sh + python aws_tester.py web-identity cd - cat <<'EOF' > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh" export AWS_WEB_IDENTITY_TOKEN_FILE=${iam_web_identity_token_file} @@ -863,23 +876,17 @@ functions: AUTH_AWS_DIR=${DRIVERS_TOOLS}/.evergreen/auth_aws ECS_SRC_DIR=$AUTH_AWS_DIR/src - # fix issue with `TestData` in SERVER-46340 - sed -i '1s+^+TestData = {};\n+' $AUTH_AWS_DIR/lib/ecs_hosted_test.js - # pack up project directory to ssh it to the container mkdir -p $ECS_SRC_DIR/.evergreen cp $PROJECT_DIRECTORY/.evergreen/run-mongodb-aws-ecs-test.sh $ECS_SRC_DIR/.evergreen tar -czf $ECS_SRC_DIR/src.tgz -C $PROJECT_DIRECTORY . - cd $AUTH_AWS_DIR - cat < setup.js - const mongo_binaries = "$MONGODB_BINARIES"; - const project_dir = "$ECS_SRC_DIR"; - EOF - - cat setup.js + set -ex + cd ${DRIVERS_TOOLS}/.evergreen/auth_aws . ./activate-authawsvenv.sh - ${MONGODB_BINARIES}/mongo --nodb setup.js aws_e2e_ecs.js + export MONGODB_BINARIES="${MONGODB_BINARIES}"; + export PROJECT_DIRECTORY=$ECS_SRC_DIR; + python aws_tester.py ecs "run-ocsp-test": - command: shell.exec diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 925f5a40e8..d4907b1415 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -627,9 +627,10 @@ functions: shell: bash script: | ${PREPARE_SHELL} + set -ex cd ${DRIVERS_TOOLS}/.evergreen/auth_aws . ./activate-authawsvenv.sh - ${MONGODB_BINARIES}/mongo aws_e2e_regular_aws.js + python aws_tester.py regular - command: shell.exec type: test params: @@ -657,9 +658,10 @@ functions: shell: bash script: | ${PREPARE_SHELL} + set -ex cd ${DRIVERS_TOOLS}/.evergreen/auth_aws . ./activate-authawsvenv.sh - ${MONGODB_BINARIES}/mongo aws_e2e_assume_role.js + python aws_tester.py assume-role - command: shell.exec type: test params: @@ -694,9 +696,10 @@ functions: # Write an empty prepare_mongodb_aws so no auth environment variables # are set. echo "" > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh" + set -ex cd ${DRIVERS_TOOLS}/.evergreen/auth_aws . ./activate-authawsvenv.sh - ${MONGODB_BINARIES}/mongo aws_e2e_ec2.js + python aws_tester.py ec2 - command: shell.exec type: test params: @@ -711,9 +714,12 @@ functions: params: working_dir: src silent: true + shell: bash script: | + set -ex cd ${DRIVERS_TOOLS}/.evergreen/auth_aws - ${MONGODB_BINARIES}/mongo --verbose aws_e2e_regular_aws.js + . ./activate-authawsvenv.sh + python aws_tester.py regular cd - cat < "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh" export AWS_ACCESS_KEY_ID=${iam_auth_ecs_account} @@ -733,9 +739,12 @@ functions: params: working_dir: src silent: true + shell: bash script: | + set -ex cd ${DRIVERS_TOOLS}/.evergreen/auth_aws - ${MONGODB_BINARIES}/mongo --verbose aws_e2e_assume_role.js + . ./activate-authawsvenv.sh + python aws_tester.py assume-role cd - cat <<'EOF' > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh" export AWS_ACCESS_KEY_ID=$(jq -r '.AccessKeyId' ${DRIVERS_TOOLS}/.evergreen/auth_aws/creds.json) @@ -756,10 +765,12 @@ functions: params: working_dir: src silent: true + shell: bash script: | + set -ex cd ${DRIVERS_TOOLS}/.evergreen/auth_aws - . ./activate_venv.sh - ${MONGODB_BINARIES}/mongo --verbose aws_e2e_web_identity.js + . ./activate-authawsvenv.sh + python aws_tester.py web-identity cd - cat <<'EOF' > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh" export AWS_WEB_IDENTITY_TOKEN_FILE=${iam_web_identity_token_file} @@ -780,10 +791,12 @@ functions: params: working_dir: src silent: true + shell: bash script: | + set -ex cd ${DRIVERS_TOOLS}/.evergreen/auth_aws - . ./activate_venv.sh - ${MONGODB_BINARIES}/mongo --verbose aws_e2e_web_identity.js + . ./activate-authawsvenv.sh + python aws_tester.py web-identity cd - cat <<'EOF' > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh" export AWS_WEB_IDENTITY_TOKEN_FILE=${iam_web_identity_token_file} @@ -808,23 +821,17 @@ functions: AUTH_AWS_DIR=${DRIVERS_TOOLS}/.evergreen/auth_aws ECS_SRC_DIR=$AUTH_AWS_DIR/src - # fix issue with `TestData` in SERVER-46340 - sed -i '1s+^+TestData = {};\n+' $AUTH_AWS_DIR/lib/ecs_hosted_test.js - # pack up project directory to ssh it to the container mkdir -p $ECS_SRC_DIR/.evergreen cp $PROJECT_DIRECTORY/.evergreen/run-mongodb-aws-ecs-test.sh $ECS_SRC_DIR/.evergreen tar -czf $ECS_SRC_DIR/src.tgz -C $PROJECT_DIRECTORY . - cd $AUTH_AWS_DIR - cat < setup.js - const mongo_binaries = "$MONGODB_BINARIES"; - const project_dir = "$ECS_SRC_DIR"; - EOF - - cat setup.js + set -ex + cd ${DRIVERS_TOOLS}/.evergreen/auth_aws . ./activate-authawsvenv.sh - ${MONGODB_BINARIES}/mongo --nodb setup.js aws_e2e_ecs.js + export MONGODB_BINARIES="${MONGODB_BINARIES}"; + export PROJECT_DIRECTORY=$ECS_SRC_DIR; + python aws_tester.py ecs run-ocsp-test: - command: shell.exec type: test diff --git a/.evergreen/run-orchestration.sh b/.evergreen/run-orchestration.sh index 74cea23b0c..ef0f099cba 100644 --- a/.evergreen/run-orchestration.sh +++ b/.evergreen/run-orchestration.sh @@ -30,4 +30,7 @@ echo "COMPRESSOR=${COMPRESSOR}" export PATH="$MONGODB_BINARIES:$PATH" echo "MONGODB_BINARIES=${MONGODB_BINARIES}" +export SKIP_LEGACY_SHELL="true" +echo "SKIP_LEGACY_SHELL=${SKIP_LEGACY_SHELL}" + bash "${DRIVERS_TOOLS}/.evergreen/run-orchestration.sh" diff --git a/test/integration/auth/mongodb_aws.test.ts b/test/integration/auth/mongodb_aws.test.ts index 4f404ffa94..9513475504 100644 --- a/test/integration/auth/mongodb_aws.test.ts +++ b/test/integration/auth/mongodb_aws.test.ts @@ -4,7 +4,6 @@ import { performance } from 'perf_hooks'; import * as sinon from 'sinon'; import { MongoAWSError, MongoClient, MongoServerError } from '../../mongodb'; -import { removeAuthFromConnectionString } from '../../tools/utils'; describe('MONGODB-AWS', function () { let client: MongoClient; @@ -20,20 +19,6 @@ describe('MONGODB-AWS', function () { await client?.close(); }); - it('should not authorize when not authenticated', async function () { - const url = removeAuthFromConnectionString(this.configuration.url()); - client = this.configuration.newClient(url); // strip provided URI of credentials - - const error = await client - .db('aws') - .collection('aws_test') - .estimatedDocumentCount() - .catch(error => error); - - expect(error).to.be.instanceOf(MongoServerError); - expect(error).to.have.property('code', 13); - }); - it('should authorize when successfully authenticated', async function () { client = this.configuration.newClient(process.env.MONGODB_URI); // use the URI built by the test environment