-
Notifications
You must be signed in to change notification settings - Fork 913
GODRIVER-2114 Fix failing KMS TLS tests #712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -827,20 +827,18 @@ functions: | |
|
||
start-kms-mock-server: | ||
- command: shell.exec | ||
type: test | ||
params: | ||
working_dir: src | ||
background: true | ||
script: | | ||
${PREPARE_SHELL} | ||
|
||
cd ${DRIVERS_TOOLS}/.evergreen/csfle | ||
cat <<EOF > kms_setup.json | ||
{ | ||
"kms_ca_file": "${KMS_CA_FILE}", | ||
"kms_cert_file": "${KMS_CERT_FILE}" | ||
} | ||
EOF | ||
mongo --nodb mock_kms.js | ||
. ./activate_venv.sh | ||
- command: shell.exec | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Much like the mock OCSP functions, the first command sets up the local environment in the foreground, and the second command starts the Python mock server in the background. These need to be separated for the tests to consistently find the mock KMS server. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting. https://github.com/evergreen-ci/evergreen/wiki/Project-Commands#shellexec notes:
My new hypothesis for the cause of the connection refused errors:
Starting the virtual environment in a non-background command before helps. But I think this is still hiding a race. If the mock KMS server does not establish listening sockets before the Go driver tests run, I suspect the same issue will occur. But, given that the OCSP tasks have a similar setup, I bet the likelihood of the KMS server not starting before the Go tests run is slim to none. If we see it failing in the future, we could consider appending a foreground command to loop until it can establish a connection on port 8000. That seems unnecessary for now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That sounds exactly right. I think all the current mock servers in testing (KMS, OCSP and maybe load balancer?) have this racey behavior. It seems that if you only have the server-starting call in the |
||
params: | ||
background: true | ||
script: | | ||
cd ${DRIVERS_TOOLS}/.evergreen/csfle | ||
./kmstlsvenv/bin/python3 -u kms_http_server.py -v --ca_file ../x509gen/ca.pem --cert_file ../x509gen/${CERT_FILE} --port 8000 | ||
|
||
run-kms-tls-test: | ||
- command: shell.exec | ||
|
@@ -1719,8 +1717,7 @@ tasks: | |
SSL: "nossl" | ||
- func: start-kms-mock-server | ||
vars: | ||
KMS_CA_FILE: "ca.pem" | ||
KMS_CERT_FILE: "expired.pem" | ||
CERT_FILE: "expired.pem" | ||
- func: run-kms-tls-test | ||
vars: | ||
KMS_TLS_TESTCASE: "INVALID_CERT" | ||
|
@@ -1738,8 +1735,7 @@ tasks: | |
SSL: "nossl" | ||
- func: start-kms-mock-server | ||
vars: | ||
KMS_CA_FILE: "ca.pem" | ||
KMS_CERT_FILE: "wrong-host.pem" | ||
CERT_FILE: "wrong-host.pem" | ||
- func: run-kms-tls-test | ||
vars: | ||
KMS_TLS_TESTCASE: "INVALID_HOSTNAME" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing
type: test
seems right here. The defaultcommand_type
on L13 issetup
. If this task fails it will indicate a setup failure, rather than a test failure (https://github.com/evergreen-ci/evergreen/wiki/Project-Configuration-Files#command-failure-colors)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah
setup
definitely seems like the right type; not sure why I hadtest
before.