Skip to content

Commit 64cd12b

Browse files
committed
CSHARP-2903: Update Windows tests in EG to add certificates to system store
1 parent 303c274 commit 64cd12b

File tree

4 files changed

+29
-8
lines changed

4 files changed

+29
-8
lines changed

evergreen/add-certs.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
set -o xtrace # Write all commands first to stderr
4+
set -o errexit # Exit the script with an error if any of the commands fail
5+
6+
if [[ "$OS" =~ Windows|windows ]]; then
7+
certutil.exe -addstore "Root" ${DRIVERS_TOOLS}/.evergreen/x509gen/ca.pem
8+
fi

evergreen/evergreen.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,9 @@ functions:
218218
export FLE_AWS_ACCESS_KEY_ID=${FLE_AWS_ACCESS_KEY_ID}
219219
export FLE_AWS_SECRET_ACCESS_KEY=${FLE_AWS_SECRET_ACCESS_KEY}
220220
${PREPARE_SHELL}
221+
evergreen/add-certs.sh
221222
AUTH=${AUTH} SSL=${SSL} MONGODB_URI="${MONGODB_URI}" TOPOLOGY=${TOPOLOGY} OS=${OS} COMPRESSOR=${COMPRESSOR} evergreen/run-tests.sh
223+
evergreen/remove-certs.sh
222224
223225
run-atlas-connectivity-tests:
224226
- command: shell.exec
@@ -309,7 +311,7 @@ pre:
309311
- func: fix-absolute-paths
310312
- func: init-test-results
311313
- func: make-files-executable
312-
314+
313315
post:
314316
# Removed, causing timeouts
315317
# - func: upload-working-dir
@@ -366,7 +368,7 @@ axes:
366368
- id: "4.2"
367369
display_name: "4.2"
368370
variables:
369-
VERSION: "4.2"
371+
VERSION: "4.2"
370372
- id: "4.0"
371373
display_name: "4.0"
372374
variables:

evergreen/remove-certs.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
3+
set -o xtrace # Write all commands first to stderr
4+
set -o errexit # Exit the script with an error if any of the commands fail
5+
6+
if [[ "$OS" =~ Windows|windows ]]; then
7+
certutil.exe -delstore "Root" \
8+
`openssl x509 -noout -text -in ${DRIVERS_TOOLS}/.evergreen/x509gen/ca.pem\
9+
| grep Serial\
10+
| sed 's/.*(0x\(.*\))/\1/'`
11+
fi

evergreen/run-tests.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ set -o errexit # Exit the script with error if any of the commands fail
77
# AUTH Set to enable authentication. Values are: "auth" / "noauth" (default)
88
# SSL Set to enable SSL. Values are "ssl" / "nossl" (default)
99
# MONGODB_URI Set the suggested connection MONGODB_URI (including credentials and topology info)
10-
# TOPOLOGY Allows you to modify variables and the MONGODB_URI based on test topology
10+
# TOPOLOGY Allows you to modify variables and the MONGODB_URI based on test topology
1111
# Supported values: "server", "replica_set", "sharded_cluster"
1212

1313
AUTH=${AUTH:-noauth}
@@ -25,9 +25,9 @@ provision_ssl () {
2525
uri_environment_variable_name=$1
2626
# Arguments for auth + SSL
2727
if [ "$AUTH" != "noauth" ] || [ "$TOPOLOGY" == "replica_set" ]; then
28-
export $uri_environment_variable_name="${!uri_environment_variable_name}&ssl=true&sslVerifyCertificate=false"
28+
export $uri_environment_variable_name="${!uri_environment_variable_name}&ssl=true"
2929
else
30-
export $uri_environment_variable_name="${!uri_environment_variable_name}/?ssl=true&sslVerifyCertificate=false"
30+
export $uri_environment_variable_name="${!uri_environment_variable_name}/?ssl=true"
3131
fi
3232
}
3333

@@ -57,7 +57,7 @@ fi
5757
if [ "$SSL" != "nossl" ]; then
5858
provision_ssl MONGODB_URI
5959
if [ "$TOPOLOGY" == "sharded_cluster" ]; then
60-
provision_ssl MONGODB_URI_WITH_MULTIPLE_MONGOSES
60+
provision_ssl MONGODB_URI_WITH_MULTIPLE_MONGOSES
6161
fi
6262
fi
6363

@@ -80,7 +80,7 @@ echo "Final MongoDB_URI: $MONGODB_URI"
8080
if [ "$TOPOLOGY" == "sharded_cluster" ]; then
8181
echo "Final MongoDB URI with multiple mongoses: $MONGODB_URI_WITH_MULTIPLE_MONGOSES"
8282
fi
83-
for var in TMP TEMP NUGET_PACKAGES NUGET_HTTP_CACHE_PATH APPDATA; do
84-
export $var=z:\\data\\tmp;
83+
for var in TMP TEMP NUGET_PACKAGES NUGET_HTTP_CACHE_PATH APPDATA; do
84+
export $var=z:\\data\\tmp;
8585
done
8686
powershell.exe .\\build.ps1 -target ${TARGET}

0 commit comments

Comments
 (0)