forked from mongodb/mongo-csharp-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-tests.sh
60 lines (47 loc) · 2.03 KB
/
run-tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
set -o xtrace # Write all commands first to stderr
set -o errexit # Exit the script with error if any of the commands fail
# Supported/used environment variables:
# AUTH Set to enable authentication. Values are: "auth" / "noauth" (default)
# SSL Set to enable SSL. Values are "ssl" / "nossl" (default)
# MONGODB_URI Set the suggested connection MONGODB_URI (including credentials and topology info)
# TOPOLOGY Allows you to modify variables and the MONGODB_URI based on test topology
# Supported values: "server", "replica_set", "sharded_cluster"
AUTH=${AUTH:-noauth}
SSL=${SSL:-nossl}
MONGODB_URI=${MONGODB_URI:-}
TOPOLOGY=${TOPOLOGY:-server}
############################################
# Functions #
############################################
provision_ssl () {
echo "SSL !"
# Arguments for auth + SSL
if [ "$AUTH" != "noauth" ] || [ "$TOPOLOGY" == "replica_set" ]; then
export MONGODB_URI="${MONGODB_URI}&ssl=true&sslVerifyCertificate=false"
else
export MONGODB_URI="${MONGODB_URI}/?ssl=true&sslVerifyCertificate=false"
fi
}
############################################
# Main Program #
############################################
# Provision the correct connection string and set up SSL if needed
if [ "$TOPOLOGY" == "sharded_cluster" ]; then
if [ "$AUTH" = "auth" ]; then
export MONGODB_URI="mongodb://bob:pwd123@localhost:27017/?authSource=admin"
else
export MONGODB_URI="mongodb://localhost:27017"
fi
fi
if [ "$SSL" != "nossl" ]; then
provision_ssl
fi
echo "Running $AUTH tests over $SSL for $TOPOLOGY and connecting to $MONGODB_URI"
if [ "$OS" == "windows-64" ]; then
export TARGET="TestWindows"
else
export TARGET="TestLinux"
fi
for var in TMP TEMP NUGET_PACKAGES NUGET_HTTP_CACHE_PATH APPDATA; do setx $var z:\\data\\tmp; export $var=z:\\data\\tmp; done
powershell.exe .\\build.ps1 -target ${TARGET}