Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ functions:
script: |
${PREPARE_SHELL}
sh ${DRIVERS_TOOLS}/.evergreen/stop-orchestration.sh

"upload-mo-artifacts":
- command: shell.exec
params:
Expand Down Expand Up @@ -152,7 +153,12 @@ functions:
SSL=${SSL} \
AUTH=${AUTH} \
SWIFT_VERSION=${SWIFT_VERSION} \
sh ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
${PROJECT_DIRECTORY}/.evergreen/run-tests.sh

"upload test results":
- command: attach.xunit_results
params:
file: ./src/testResults.xml

"run atlas tests":
- command: shell.exec
Expand Down Expand Up @@ -199,6 +205,7 @@ pre:
post:
- func: "stop mongo-orchestration"
- func: "upload-mo-artifacts"
- func: "upload test results"
- func: "cleanup"

tasks:
Expand Down
4 changes: 4 additions & 0 deletions .evergreen/install-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ INSTALL_DIR="${PROJECT_DIRECTORY}/opt"
BUILD_DIR="${PROJECT_DIRECTORY}/libmongoc-build"
EVG_DIR=$(dirname $0)

# this is set by drivers-matrix-testing, and it's a special variable used in swiftenv
# leaving it set messes with the installation
unset PLATFORM
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this shouldn't affect the test suite if it needs access to $PLATFORM, since we run install-dependencies.sh in its own shell


export SWIFTENV_ROOT="${INSTALL_DIR}/swiftenv"
export PATH=/opt/cmake/bin:${SWIFTENV_ROOT}/bin:$PATH

Expand Down
28 changes: 25 additions & 3 deletions .evergreen/run-tests.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
#!/bin/sh
#!/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

# variables
PROJECT_DIRECTORY=${PROJECT_DIRECTORY:-$PWD}
MONGODB_URI=${MONGODB_URI:-"NO_URI_PROVIDED"}
SWIFT_VERSION=${SWIFT_VERSION:-5.0.3}
SWIFT_VERSION=${SWIFT_VERSION:-5.2.5}
INSTALL_DIR="${PROJECT_DIRECTORY}/opt"
TOPOLOGY=${TOPOLOGY:-single}
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
EXTRA_FLAGS="-Xlinker -rpath -Xlinker ${INSTALL_DIR}/lib"
RAW_TEST_RESULTS="${PROJECT_DIRECTORY}/rawTestResults"
XML_TEST_RESULTS="${PROJECT_DIRECTORY}/testResults.xml"
INSTALL_DEPS=${INSTALL_DEPS:-"false"}

# ssl setup
SSL=${SSL:-nossl}
Expand All @@ -18,6 +21,13 @@ if [ "$SSL" != "nossl" ]; then
export SSL_CA_FILE="$DRIVERS_TOOLS/.evergreen/x509gen/ca.pem"
fi

# if dependencies were not installed separately, do so now.
# this is used for continous matrix testing
if [ "$INSTALL_DEPS" == "true" ]; then
SWIFT_VERSION=${SWIFT_VERSION} \
sh ${PROJECT_DIRECTORY}/.evergreen/install-dependencies.sh
fi

# enable swiftenv
export SWIFTENV_ROOT="${INSTALL_DIR}/swiftenv"
export PATH="${SWIFTENV_ROOT}/bin:$PATH"
Expand All @@ -35,4 +45,16 @@ swiftenv local $SWIFT_VERSION
swift build $EXTRA_FLAGS

# test the driver
MONGODB_TOPOLOGY=${TOPOLOGY} MONGODB_URI=$MONGODB_URI swift test $EXTRA_FLAGS
set +o errexit # even if tests fail we want to parse the results, so disable errexit
set -o pipefail # propagate error codes in the following pipes

MONGODB_TOPOLOGY=${TOPOLOGY} MONGODB_URI=$MONGODB_URI swift test $EXTRA_FLAGS 2>&1 | tee ${RAW_TEST_RESULTS}

# save tests exit code
EXIT_CODE=$?

# convert tests to XML
cat ${RAW_TEST_RESULTS} | swift "${PROJECT_DIRECTORY}/etc/convert-test-results.swift" > ${XML_TEST_RESULTS}

# exit with exit code for running the tests
exit $EXIT_CODE
1 change: 1 addition & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ excluded:
- Tests/LinuxMain.swift
- Sources/MongoSwiftSync/Exports.swift
- SwiftFormat # this is the path we download SwiftFormat to on travis
- Sources/MongoSwift/MongoSwiftVersion.swift

trailing_whitespace:
ignores_comments: false
4 changes: 3 additions & 1 deletion Sources/MongoSwift/MongoCollection+Indexes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ public struct IndexOptions: Codable {
/// Optionally specifies the precision of the stored geo hash in the 2d index, from 1 to 32.
public var bits: Int?

/// Optionally specifies the number of units within which to group the location values in a geo haystack index.
/// Optionally specifies the number of units within which to group the location values in a geoHaystack index.
/// Note: geoHaystack indexes are deprecated in MongoDB 4.4 and will be removed in a future version of the
/// server.
public var bucketSize: Int?

/// Optionally specifies a collation to use for the index in MongoDB 3.4 and higher. If not specified, no collation
Expand Down
1 change: 0 additions & 1 deletion Tests/MongoSwiftSyncTests/MongoCollection+IndexTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ final class MongoCollection_IndexTests: MongoSwiftTestCase {
let options = IndexOptions(
background: true,
bits: 32,
bucketSize: 10,
collation: ["locale": "fr"],
defaultLanguage: "english",
languageOverride: "cat",
Expand Down
Loading