Skip to content

Commit 53b7ef2

Browse files
authored
SWIFT-1061 Update r1.0 branch to support matrix testing (#604)
1 parent 0138564 commit 53b7ef2

File tree

7 files changed

+388
-6
lines changed

7 files changed

+388
-6
lines changed

.evergreen/config.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ functions:
122122
script: |
123123
${PREPARE_SHELL}
124124
sh ${DRIVERS_TOOLS}/.evergreen/stop-orchestration.sh
125+
125126
"upload-mo-artifacts":
126127
- command: shell.exec
127128
params:
@@ -152,7 +153,12 @@ functions:
152153
SSL=${SSL} \
153154
AUTH=${AUTH} \
154155
SWIFT_VERSION=${SWIFT_VERSION} \
155-
sh ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
156+
${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
157+
158+
"upload test results":
159+
- command: attach.xunit_results
160+
params:
161+
file: ./src/testResults.xml
156162

157163
"run atlas tests":
158164
- command: shell.exec
@@ -199,6 +205,7 @@ pre:
199205
post:
200206
- func: "stop mongo-orchestration"
201207
- func: "upload-mo-artifacts"
208+
- func: "upload test results"
202209
- func: "cleanup"
203210

204211
tasks:

.evergreen/install-dependencies.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ INSTALL_DIR="${PROJECT_DIRECTORY}/opt"
99
BUILD_DIR="${PROJECT_DIRECTORY}/libmongoc-build"
1010
EVG_DIR=$(dirname $0)
1111

12+
# this is set by drivers-matrix-testing, and it's a special variable used in swiftenv
13+
# leaving it set messes with the installation
14+
unset PLATFORM
15+
1216
export SWIFTENV_ROOT="${INSTALL_DIR}/swiftenv"
1317
export PATH=/opt/cmake/bin:${SWIFTENV_ROOT}/bin:$PATH
1418

.evergreen/run-tests.sh

100644100755
Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1-
#!/bin/sh
1+
#!/bin/bash
22
set -o xtrace # Write all commands first to stderr
33
set -o errexit # Exit the script with error if any of the commands fail
44

55
# variables
66
PROJECT_DIRECTORY=${PROJECT_DIRECTORY:-$PWD}
77
MONGODB_URI=${MONGODB_URI:-"NO_URI_PROVIDED"}
8-
SWIFT_VERSION=${SWIFT_VERSION:-5.0.3}
8+
SWIFT_VERSION=${SWIFT_VERSION:-5.2.5}
99
INSTALL_DIR="${PROJECT_DIRECTORY}/opt"
1010
TOPOLOGY=${TOPOLOGY:-single}
1111
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
1212
EXTRA_FLAGS="-Xlinker -rpath -Xlinker ${INSTALL_DIR}/lib"
13+
RAW_TEST_RESULTS="${PROJECT_DIRECTORY}/rawTestResults"
14+
XML_TEST_RESULTS="${PROJECT_DIRECTORY}/testResults.xml"
15+
INSTALL_DEPS=${INSTALL_DEPS:-"false"}
1316

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

24+
# if dependencies were not installed separately, do so now.
25+
# this is used for continous matrix testing
26+
if [ "$INSTALL_DEPS" == "true" ]; then
27+
SWIFT_VERSION=${SWIFT_VERSION} \
28+
sh ${PROJECT_DIRECTORY}/.evergreen/install-dependencies.sh
29+
fi
30+
2131
# enable swiftenv
2232
export SWIFTENV_ROOT="${INSTALL_DIR}/swiftenv"
2333
export PATH="${SWIFTENV_ROOT}/bin:$PATH"
@@ -35,4 +45,16 @@ swiftenv local $SWIFT_VERSION
3545
swift build $EXTRA_FLAGS
3646

3747
# test the driver
38-
MONGODB_TOPOLOGY=${TOPOLOGY} MONGODB_URI=$MONGODB_URI swift test $EXTRA_FLAGS
48+
set +o errexit # even if tests fail we want to parse the results, so disable errexit
49+
set -o pipefail # propagate error codes in the following pipes
50+
51+
MONGODB_TOPOLOGY=${TOPOLOGY} MONGODB_URI=$MONGODB_URI swift test $EXTRA_FLAGS 2>&1 | tee ${RAW_TEST_RESULTS}
52+
53+
# save tests exit code
54+
EXIT_CODE=$?
55+
56+
# convert tests to XML
57+
cat ${RAW_TEST_RESULTS} | swift "${PROJECT_DIRECTORY}/etc/convert-test-results.swift" > ${XML_TEST_RESULTS}
58+
59+
# exit with exit code for running the tests
60+
exit $EXIT_CODE

.swiftlint.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ excluded:
5454
- Tests/LinuxMain.swift
5555
- Sources/MongoSwiftSync/Exports.swift
5656
- SwiftFormat # this is the path we download SwiftFormat to on travis
57+
- Sources/MongoSwift/MongoSwiftVersion.swift
5758

5859
trailing_whitespace:
5960
ignores_comments: false

Sources/MongoSwift/MongoCollection+Indexes.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ public struct IndexOptions: Codable {
4646
/// Optionally specifies the precision of the stored geo hash in the 2d index, from 1 to 32.
4747
public var bits: Int?
4848

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

5254
/// Optionally specifies a collation to use for the index in MongoDB 3.4 and higher. If not specified, no collation

Tests/MongoSwiftSyncTests/MongoCollection+IndexTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ final class MongoCollection_IndexTests: MongoSwiftTestCase {
7676
let options = IndexOptions(
7777
background: true,
7878
bits: 32,
79-
bucketSize: 10,
8079
collation: ["locale": "fr"],
8180
defaultLanguage: "english",
8281
languageOverride: "cat",

0 commit comments

Comments
 (0)