@@ -206,6 +206,7 @@ functions:
206
206
TOPOLOGY=${TOPOLOGY} \
207
207
AUTH=${AUTH} \
208
208
SSL=${SSL} \
209
+ STORAGE_ENGINE=${STORAGE_ENGINE} \
209
210
ORCHESTRATION_FILE=${ORCHESTRATION_FILE} \
210
211
sh ${DRIVERS_TOOLS}/.evergreen/run-orchestration.sh
211
212
# run-orchestration generates expansion file with the MONGODB_URI for the cluster
@@ -261,6 +262,152 @@ functions:
261
262
${PREPARE_SHELL}
262
263
MONGODB_URI="${plain_auth_mongodb_uri}" evergreen/run-plain-auth-tests.sh
263
264
265
+ add-aws-auth-variables-to-file :
266
+ - command : shell.exec
267
+ type : test
268
+ params :
269
+ working_dir : mongo-csharp-driver
270
+ silent : true
271
+ script : |
272
+ cat <<EOF > ${DRIVERS_TOOLS}/.evergreen/auth_aws/aws_e2e_setup.json
273
+ {
274
+ "iam_auth_ecs_account" : "${iam_auth_ecs_account}",
275
+ "iam_auth_ecs_secret_access_key" : "${iam_auth_ecs_secret_access_key}",
276
+ "iam_auth_ecs_account_arn": "arn:aws:iam::557821124784:user/authtest_fargate_user",
277
+ "iam_auth_ecs_cluster": "${iam_auth_ecs_cluster}",
278
+ "iam_auth_ecs_task_definition": "${iam_auth_ecs_task_definition}",
279
+ "iam_auth_ecs_subnet_a": "${iam_auth_ecs_subnet_a}",
280
+ "iam_auth_ecs_subnet_b": "${iam_auth_ecs_subnet_b}",
281
+ "iam_auth_ecs_security_group": "${iam_auth_ecs_security_group}",
282
+ "iam_auth_assume_aws_account" : "${iam_auth_assume_aws_account}",
283
+ "iam_auth_assume_aws_secret_access_key" : "${iam_auth_assume_aws_secret_access_key}",
284
+ "iam_auth_assume_role_name" : "${iam_auth_assume_role_name}",
285
+ "iam_auth_ec2_instance_account" : "${iam_auth_ec2_instance_account}",
286
+ "iam_auth_ec2_instance_secret_access_key" : "${iam_auth_ec2_instance_secret_access_key}",
287
+ "iam_auth_ec2_instance_profile" : "${iam_auth_ec2_instance_profile}"
288
+ }
289
+ EOF
290
+
291
+ run-aws-auth-test-with-regular-aws-credentials :
292
+ - command : shell.exec
293
+ type : test
294
+ params :
295
+ working_dir : mongo-csharp-driver
296
+ script : |
297
+ ${PREPARE_SHELL}
298
+ cd ${DRIVERS_TOOLS}/.evergreen/auth_aws
299
+ mongo aws_e2e_regular_aws.js
300
+ - command : shell.exec
301
+ type : test
302
+ params :
303
+ working_dir : mongo-csharp-driver
304
+ script : |
305
+ cat <<'EOF' > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh"
306
+ alias urlencode='python -c "import sys, urllib as ul; sys.stdout.write(ul.quote_plus(sys.argv[1]))"'
307
+ USER=$(urlencode "${iam_auth_ecs_account}")
308
+ PASS=$(urlencode "${iam_auth_ecs_secret_access_key}")
309
+ MONGODB_URI="mongodb://$USER:$PASS@localhost"
310
+ EOF
311
+ PROJECT_DIRECTORY=${PROJECT_DIRECTORY} evergreen/run-mongodb-aws-test.sh
312
+
313
+ run-aws-auth-test-with-assume-role-credentials :
314
+ - command : shell.exec
315
+ type : test
316
+ params :
317
+ working_dir : mongo-csharp-driver
318
+ script : |
319
+ ${PREPARE_SHELL}
320
+ # The aws_e2e_assume_role script requires python3 with boto3.
321
+ virtualenv -p C:/python/Python38/python.exe mongovenv
322
+ . mongovenv/Scripts/activate
323
+ pip install boto3
324
+ cd ${DRIVERS_TOOLS}/.evergreen/auth_aws
325
+ mongo aws_e2e_assume_role.js
326
+ - command : shell.exec
327
+ type : test
328
+ params :
329
+ working_dir : mongo-csharp-driver
330
+ script : |
331
+ # DO NOT ECHO WITH XTRACE (which PREPARE_SHELL does)
332
+ cat <<'EOF' > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh"
333
+ alias urlencode='python -c "import sys, urllib as ul; sys.stdout.write(ul.quote_plus(sys.argv[1]))"'
334
+ alias jsonkey='python -c "import json,sys;sys.stdout.write(json.load(sys.stdin)[sys.argv[1]])" < ${DRIVERS_TOOLS}/.evergreen/auth_aws/creds.json'
335
+ USER=$(jsonkey AccessKeyId)
336
+ USER=$(urlencode $USER)
337
+ PASS=$(jsonkey SecretAccessKey)
338
+ PASS=$(urlencode $PASS)
339
+ SESSION_TOKEN=$(jsonkey SessionToken)
340
+ SESSION_TOKEN=$(urlencode $SESSION_TOKEN)
341
+ MONGODB_URI="mongodb://$USER:$PASS@localhost"
342
+ EOF
343
+ PROJECT_DIRECTORY=${PROJECT_DIRECTORY} DRIVERS_TOOLS=${DRIVERS_TOOLS} evergreen/run-mongodb-aws-test.sh
344
+
345
+ run-aws-auth-test-with-aws-EC2-credentials :
346
+ - command : shell.exec
347
+ type : test
348
+ params :
349
+ working_dir : mongo-csharp-driver
350
+ script : |
351
+ ${PREPARE_SHELL}
352
+ # The aws_e2e_assume_role script requires python3 with boto3.
353
+ virtualenv -p C:/python/Python38/python.exe mongovenv
354
+ . mongovenv/Scripts/activate
355
+ pip install boto3
356
+ cd ${DRIVERS_TOOLS}/.evergreen/auth_aws
357
+ mongo aws_e2e_ec2.js
358
+ - command : shell.exec
359
+ type : test
360
+ params :
361
+ working_dir : mongo-csharp-driver
362
+ script : |
363
+ # DO NOT ECHO WITH XTRACE (which PREPARE_SHELL does)
364
+ cat <<'EOF' > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh"
365
+ MONGODB_URI="mongodb://localhost"
366
+ EOF
367
+ PROJECT_DIRECTORY=${PROJECT_DIRECTORY} evergreen/run-mongodb-aws-test.sh
368
+
369
+ run-aws-auth-test-with-aws-credentials-as-environment-variables :
370
+ - command : shell.exec
371
+ type : test
372
+ params :
373
+ working_dir : mongo-csharp-driver
374
+ script : |
375
+ # DO NOT ECHO WITH XTRACE (which PREPARE_SHELL does)
376
+ cat <<'EOF' > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh"
377
+ export AWS_ACCESS_KEY_ID=${iam_auth_ecs_account}
378
+ export AWS_SECRET_ACCESS_KEY=${iam_auth_ecs_secret_access_key}
379
+ MONGODB_URI="mongodb://localhost"
380
+ EOF
381
+ - command : shell.exec
382
+ type : test
383
+ params :
384
+ working_dir : mongo-csharp-driver
385
+ script : |
386
+ ${PREPARE_SHELL}
387
+ evergreen/run-mongodb-aws-test.sh
388
+
389
+ run-aws-auth-test-with-aws-credentials-and-session-token-as-environment-variables :
390
+ - command : shell.exec
391
+ type : test
392
+ params :
393
+ working_dir : mongo-csharp-driver
394
+ script : |
395
+ # DO NOT ECHO WITH XTRACE (which PREPARE_SHELL does)
396
+ cat <<'EOF' > "${PROJECT_DIRECTORY}/prepare_mongodb_aws.sh"
397
+ alias jsonkey='python -c "import json,sys;sys.stdout.write(json.load(sys.stdin)[sys.argv[1]])" < ${DRIVERS_TOOLS}/.evergreen/auth_aws/creds.json'
398
+ export AWS_ACCESS_KEY_ID=$(jsonkey AccessKeyId)
399
+ export AWS_SECRET_ACCESS_KEY=$(jsonkey SecretAccessKey)
400
+ export AWS_SESSION_TOKEN=$(jsonkey SessionToken)
401
+ MONGODB_URI="mongodb://localhost"
402
+ EOF
403
+ - command : shell.exec
404
+ type : test
405
+ params :
406
+ working_dir : mongo-csharp-driver
407
+ script : |
408
+ ${PREPARE_SHELL}
409
+ evergreen/run-mongodb-aws-test.sh
410
+
264
411
run-ocsp-test :
265
412
- command : shell.exec
266
413
type : test
@@ -465,6 +612,24 @@ tasks:
465
612
commands :
466
613
- func : run-plain-auth-tests
467
614
615
+ - name : aws-auth-tests
616
+ depends_on :
617
+ - variant : windows-64-compile
618
+ name : compile
619
+ commands :
620
+ - func : bootstrap-mongo-orchestration
621
+ vars :
622
+ AUTH : " auth"
623
+ ORCHESTRATION_FILE : " auth-aws.json"
624
+ TOPOLOGY : " server"
625
+ - func : add-aws-auth-variables-to-file
626
+ - func : run-aws-auth-test-with-regular-aws-credentials
627
+ - func : run-aws-auth-test-with-assume-role-credentials
628
+ - func : run-aws-auth-test-with-aws-credentials-as-environment-variables
629
+ - func : run-aws-auth-test-with-aws-credentials-and-session-token-as-environment-variables
630
+ - func : run-aws-auth-test-with-aws-EC2-credentials
631
+ # ECS test is skipped untill testing on Linux becomes possible
632
+
468
633
- name : publish-snapshot
469
634
depends_on :
470
635
- variant : " .tests-variant"
@@ -944,6 +1109,14 @@ buildvariants:
944
1109
tasks :
945
1110
- name : " .ocsp"
946
1111
1112
+ - matrix_name : aws-auth-tests
1113
+ matrix_spec : { version: ["latest"], topology: "standalone", os: "*" }
1114
+ display_name : " MONGODB-AWS Auth test"
1115
+ run_on :
1116
+ - windows-64-vs2017-test
1117
+ tasks :
1118
+ - name : aws-auth-tests
1119
+
947
1120
- name : atlas-connectivity-tests
948
1121
display_name : " Atlas Connectivity Tests"
949
1122
run_on :
0 commit comments