Skip to content

Commit e6892af

Browse files
authored
RUST-1674 Use cargo-nextest as test runner (#929)
1 parent e2d0f44 commit e6892af

15 files changed

+58
-51
lines changed

.config/nextest.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[profile.default]
2+
retries = 1
3+
4+
[profile.ci]
5+
failure-output = "final"
6+
test-threads = 1
7+
fail-fast = false
8+
9+
[profile.ci.junit]
10+
path = "junit.xml"

.evergreen/cargo-test.sh

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
CARGO_OPTIONS=()
4-
TEST_OPTIONS=("-Z unstable-options" "--format json" "--report-time")
4+
TEST_OPTIONS=()
55
FEATURE_FLAGS=()
66
CARGO_RESULT=0
77

@@ -26,17 +26,11 @@ cargo_test_options() {
2626
if (( ${#FILTERED[@]} != 0 )); then
2727
FEATURE_OPTION="--features $(join_by , "${FILTERED[@]}")"
2828
fi
29-
local THREAD_OPTION=""
30-
if [ "${SINGLE_THREAD}" = true ]; then
31-
THREAD_OPTION="--test-threads=1"
32-
fi
33-
echo $1 ${CARGO_OPTIONS[@]} ${FEATURE_OPTION} -- ${TEST_OPTIONS[@]} ${THREAD_OPTION}
29+
echo $1 ${CARGO_OPTIONS[@]} ${FEATURE_OPTION} -- ${TEST_OPTIONS[@]}
3430
}
3531

3632
cargo_test() {
37-
RUST_BACKTRACE=1 \
38-
cargo test $(cargo_test_options $1) \
39-
| grep -v '{"t":' \
40-
| cargo2junit
33+
RUST_BACKTRACE=1 cargo nextest run --profile ci $(cargo_test_options $1)
4134
(( CARGO_RESULT = ${CARGO_RESULT} || $? ))
35+
mv target/nextest/ci/junit.xml $2
4236
}

.evergreen/config.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ stepback: true
1313
command_type: system
1414

1515
# Protect ourself against rogue test case, or curl gone wild, that runs forever
16-
# 12 minutes is the longest we'll ever run
17-
exec_timeout_secs: 3600 # 12 minutes is the longest we'll ever run
16+
# TODO RUST-1721 Reduce this
17+
exec_timeout_secs: 5400
1818

1919
# What to do when evergreen hits the timeout (`post:` tasks are run automatically)
2020
timeout:
@@ -453,8 +453,7 @@ functions:
453453
SNAPPY_COMPRESSION_ENABLED=${SNAPPY_COMPRESSION_ENABLED} \
454454
ZLIB_COMPRESSION_ENABLED=${ZLIB_COMPRESSION_ENABLED} \
455455
ZSTD_COMPRESSION_ENABLED=${ZSTD_COMPRESSION_ENABLED} \
456-
SINGLE_THREAD=${SINGLE_THREAD} \
457-
ASYNC_RUNTIME=${ASYNC_RUNTIME} \
456+
ASYNC_RUNTIME=${ASYNC_RUNTIME} \
458457
MONGODB_API_VERSION=${MONGODB_API_VERSION} \
459458
TLS_FEATURE=${TLS_FEATURE} \
460459
.evergreen/run-tests.sh
@@ -477,9 +476,8 @@ functions:
477476
. .evergreen/generate-uri.sh
478477
479478
SNAPPY_COMPRESSION_ENABLED="true" \
480-
ZLIB_COMPRESSION_ENABLED="true" \
481-
ZSTD_COMPRESSION_ENABLED="true" \
482-
SINGLE_THREAD=${SINGLE_THREAD} \
479+
ZLIB_COMPRESSION_ENABLED="true" \
480+
ZSTD_COMPRESSION_ENABLED="true" \
483481
ASYNC_RUNTIME=${ASYNC_RUNTIME} \
484482
MONGODB_API_VERSION=${MONGODB_API_VERSION} \
485483
TLS_FEATURE=${TLS_FEATURE} \
@@ -1625,7 +1623,6 @@ axes:
16251623
display_name: "MacOS 11.00"
16261624
run_on: macos-1100
16271625
variables:
1628-
SINGLE_THREAD: true
16291626
VENV_BIN_DIR: "bin"
16301627
LIBMONGOCRYPT_OS: "macos"
16311628
- id: windows-64-vs2017

.evergreen/install-dependencies.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,21 @@ for arg; do
2727

2828
source .evergreen/env.sh
2929
rustup toolchain install nightly -c rustfmt
30-
# TODO RUST-1674: remove this workaround
31-
rustup default 1.69
3230
elif [ $arg == "mdbook" ]; then
3331
source ${CARGO_HOME}/env
3432
# Install the manual rendering tool
3533
cargo install mdbook
3634
elif [ $arg == "junit-dependencies" ]; then
3735
source ${CARGO_HOME}/env
38-
# Install tool for converting cargo test output to junit
39-
cargo install cargo2junit
4036

4137
# install npm/node
4238
./.evergreen/install-node.sh
4339

4440
source ./.evergreen/env.sh
4541

42+
# Install junit-compatible test runner
43+
cargo install cargo-nextest --locked
44+
4645
# Install tool for merging different junit reports into a single one
4746
set +o errexit
4847
set -o pipefail

.evergreen/run-atlas-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ use_async_runtime
1010

1111
set +o errexit
1212

13-
cargo_test atlas_connectivity > results.xml
13+
cargo_test atlas_connectivity results.xml
1414

1515
exit $CARGO_RESULT

.evergreen/run-aws-tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ FEATURE_FLAGS+=("aws-auth")
4949

5050
set +o errexit
5151

52-
cargo_test auth_aws > auth_aws.xml
53-
cargo_test lambda_examples::auth::test_handler > lambda_handler.xml
52+
cargo_test auth_aws auth_aws.xml
53+
cargo_test lambda_examples::auth::test_handler lambda_handler.xml
5454

5555
junit-report-merger results.xml auth_aws.xml lambda_handler.xml
5656

.evergreen/run-connection-string-tests.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ FEATURE_FLAGS+=("aws-auth")
1111

1212
set +o errexit
1313

14-
cargo_test spec::auth > spec.xml
15-
cargo_test uri_options > uri_options.xml
16-
cargo_test connection_string > connection_string.xml
14+
cargo_test spec::auth spec.xml
15+
cargo_test uri_options uri_options.xml
16+
cargo_test connection_string connection_string.xml
1717

1818
junit-report-merger results.xml spec.xml uri_options.xml connection_string.xml
1919

.evergreen/run-csfle-tests.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ echo "cargo test options: $(cargo_test_options)"
2323

2424
set +o errexit
2525

26-
cargo_test test::csfle > prose.xml
27-
cargo_test test::spec::client_side_encryption > spec.xml
26+
cargo_test test::csfle prose.xml
27+
cargo_test test::spec::client_side_encryption spec.xml
2828

2929
# Unset variables for on-demand credential failure tests.
3030
unset AWS_ACCESS_KEY_ID
3131
unset AWS_SECRET_ACCESS_KEY
32-
cargo_test test::csfle::on_demand_aws_failure > failure.xml
32+
cargo_test test::csfle::on_demand_aws_failure failure.xml
3333

3434
junit-report-merger results.xml prose.xml spec.xml failure.xml
3535

.evergreen/run-oidc-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ set -o xtrace
88

99
set +o errexit
1010

11-
cargo_test test::spec::oidc > prose.xml
11+
cargo_test test::spec::oidc prose.xml
1212

1313
junit-report-merger results.xml prose.xml
1414

.evergreen/run-plain-tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ source .evergreen/cargo-test.sh
88

99
set +o errexit
1010

11-
MONGO_PLAIN_AUTH_TEST=1 cargo_test plain > results.xml
11+
MONGO_PLAIN_AUTH_TEST=1 cargo_test plain results.xml
1212

1313
exit $CARGO_RESULT

0 commit comments

Comments
 (0)