PYTHON-1201 - Test GSSAPI and PLAIN authentication

This commit is contained in:
Bernie Hackett 2017-03-08 16:32:35 -08:00
parent dc3048c79b
commit 2d27fcb990
2 changed files with 73 additions and 0 deletions

View File

@ -336,6 +336,16 @@ functions:
${PREPARE_SHELL}
PYTHON_BINARY=${PYTHON_BINARY} GREEN_FRAMEWORK=${GREEN_FRAMEWORK} C_EXTENSIONS=${C_EXTENSIONS} AUTH=${AUTH} SSL=${SSL} MONGODB_URI="${MONGODB_URI}" sh ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
"run enterprise auth tests":
- command: shell.exec
type: test
params:
silent: true
working_dir: "src"
script: |
# DO NOT ECHO WITH XTRACE (which PREPARE_SHELL does)
PYTHON_BINARY=${PYTHON_BINARY} SASL_HOST=${sasl_host} SASL_PORT=${sasl_port} SASL_USER=${sasl_user} SASL_PASS=${sasl_pass} SASL_DB=${sasl_db} PRINCIPAL=${principal} GSSAPI_DB=${gssapi_db} KEYTAB_BASE64=${keytab_base64} PROJECT_DIRECTORY=${PROJECT_DIRECTORY} sh ${PROJECT_DIRECTORY}/.evergreen/run-enterprise-auth-tests.sh
"cleanup":
- command: shell.exec
params:
@ -603,6 +613,15 @@ tasks:
TOPOLOGY: "sharded_cluster"
- func: "run tests"
- name: "test-enterprise-auth"
tags: ["enterprise-auth"]
commands:
- func: "bootstrap mongo-orchestration"
vars:
VERSION: "latest"
TOPOLOGY: "server"
- func: "run enterprise auth tests"
# }}}
@ -1195,6 +1214,27 @@ buildvariants:
add_tasks:
- "test-3.0-standalone"
- matrix_name: "test-linux-enterprise-auth"
matrix_spec: {"python-version": "*", auth: "auth"}
display_name: "Enterprise Auth Linux ${python-version}"
run_on: ubuntu1604-test
tasks:
- name: "test-enterprise-auth"
- matrix_name: "tests-windows-vs2010-enterprise-auth"
matrix_spec: {"windows-vs2010-python-version": "*", auth: "auth"}
display_name: "Enterprise Auth Windows ${windows-vs2010-python-version}"
run_on: windows-64-vs2010-test
tasks:
- name: "test-enterprise-auth"
- matrix_name: "tests-windows-vs2015-enterprise-auth"
matrix_spec: {"windows-vs2015-python-version": "*", auth: "auth"}
display_name: "Enterprise Auth Windows ${windows-vs2015-python-version}"
run_on: windows-64-vs2015-test
tasks:
- name: "test-enterprise-auth"
# Platform notes
# i386 builds of OpenSSL or Cyrus SASL are not available
# Ubuntu14.04 only supports 2.6+ with SSL

View File

@ -0,0 +1,33 @@
#!/bin/bash
# Don't trace to avoid secrets showing up in the logs
set -o errexit
echo "Running enterprise authentication tests"
PLATFORM="$(${PYTHON_BINARY} -c 'import platform; print(platform.system())')"
export DB_USER="bob"
export DB_PASSWORD="pwd123"
# There is no kerberos package for Jython, but we do want to test PLAIN.
if [ ${PLATFORM} != "Java" ]; then
if [ "Windows_NT" = "$OS" ]; then
echo "Setting GSSAPI_PASS"
export GSSAPI_PASS=${SASL_PASS}
else
echo "Writing keytab"
echo ${KEYTAB_BASE64} | base64 -d > ${PROJECT_DIRECTORY}/.evergreen/drivers.keytab
echo "Running kinit"
kinit -k -t ${PROJECT_DIRECTORY}/.evergreen/drivers.keytab -p ${PRINCIPAL}
fi
echo "Setting GSSAPI variables"
export GSSAPI_HOST=${SASL_HOST}
export GSSAPI_PORT=${SASL_PORT}
export GSSAPI_PRINCIPAL=${PRINCIPAL}
fi
echo "Running tests"
${PYTHON_BINARY} setup.py clean
${PYTHON_BINARY} setup.py test --xunit-output=xunit-results