Skip to content

Commit

Permalink
test(NODE-5317): use new evergreen scripts (#3669)
Browse files Browse the repository at this point in the history
Co-authored-by: Bailey Pearson <[email protected]>
  • Loading branch information
durran and baileympearson authored May 31, 2023
1 parent 1e58a4c commit e5e3c93
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 55 deletions.
47 changes: 27 additions & 20 deletions .evergreen/config.in.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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 <<EOF > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh"
export AWS_ACCESS_KEY_ID=${iam_auth_ecs_account}
Expand All @@ -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)
Expand All @@ -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}
Expand All @@ -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}
Expand All @@ -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 <<EOF > 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
Expand Down
47 changes: 27 additions & 20 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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 <<EOF > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh"
export AWS_ACCESS_KEY_ID=${iam_auth_ecs_account}
Expand All @@ -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)
Expand All @@ -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}
Expand All @@ -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}
Expand All @@ -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 <<EOF > 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
Expand Down
3 changes: 3 additions & 0 deletions .evergreen/run-orchestration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
15 changes: 0 additions & 15 deletions test/integration/auth/mongodb_aws.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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

Expand Down

0 comments on commit e5e3c93

Please sign in to comment.