You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
2.0 KiB

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