-
Notifications
You must be signed in to change notification settings - Fork 180
RUST-656 Run tests against serverless in evergreen #504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
0cc16d1
evergreen config wip
abr-egn 50445a8
the rest of the initial serverless setup
abr-egn bbfe3a5
only run tests listed in the serverless spec
abr-egn e2a1be7
fix test client srv resolution, other minor things
abr-egn 98dd479
allow error labels nested in write concerns
abr-egn 7616e77
merge labels into toplevel; clean up dbs
abr-egn ee9dff2
properly set serverless credentials for unified test clients
abr-egn 3e74b2b
test script updates
abr-egn d790439
rustfmt
abr-egn 981aa40
newline
abr-egn e64f763
allow unset write concern error labels
abr-egn 71213f5
refix option merging
abr-egn 9f73e72
rustfmt and clippy
abr-egn abf119c
override default hosts
abr-egn 5feeac1
another stab at test host logic
abr-egn 8f5e711
export results as junit
abr-egn 68b26f6
env
abr-egn 24a6f0f
rustfmt
abr-egn 7e481c9
review updates
abr-egn d3c86c2
review updates
abr-egn 2682541
add todos
abr-egn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
|
||
source ./.evergreen/env.sh | ||
|
||
FEATURE_FLAGS="zstd-compression,snappy-compression,zlib-compression" | ||
DEFAULT_FEATURES="" | ||
|
||
if [ "$ASYNC_RUNTIME" = "async-std" ]; then | ||
FEATURE_FLAGS="${FEATURE_FLAGS},async-std-runtime" | ||
DEFAULT_FEATURES="--no-default-features" | ||
elif [ "$ASYNC_RUNTIME" != "tokio" ]; then | ||
echo "invalid async runtime: ${ASYNC_RUNTIME}" >&2 | ||
exit 1 | ||
fi | ||
|
||
OPTIONS="-- -Z unstable-options --format json --report-time" | ||
|
||
if [ "$SINGLE_THREAD" = true ]; then | ||
OPTIONS="$OPTIONS --test-threads=1" | ||
fi | ||
|
||
echo "cargo test options: ${DEFAULT_FEATURES} --features $FEATURE_FLAGS ${OPTIONS}" | ||
|
||
cargo_test() { | ||
RUST_BACKTRACE=1 \ | ||
SERVERLESS="serverless" \ | ||
cargo test ${DEFAULT_FEATURES} --features $FEATURE_FLAGS $1 $OPTIONS | cargo2junit | ||
} | ||
|
||
cargo_test test::spec::crud > crud.xml | ||
cargo_test test::spec::retryable_reads > retryable_reads.xml | ||
cargo_test test::spec::retryable_writes > retryable_writes.xml | ||
cargo_test test::spec::versioned_api > versioned_api.xml | ||
cargo_test test::spec::sessions > sessions.xml | ||
cargo_test test::spec::transactions > transactions.xml | ||
cargo_test test::spec::load_balancers > load_balancers.xml | ||
cargo_test test::cursor > cursor.xml | ||
|
||
junit-report-merger results.xml crud.xml retryable_reads.xml retryable_writes.xml versioned_api.xml sessions.xml transactions.xml load_balancers.xml cursor.xml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1078,46 +1078,51 @@ where | |
|
||
n_attempted += current_batch_size; | ||
} | ||
Err(e) => match *e.kind { | ||
ErrorKind::BulkWrite(bw) => { | ||
// for ordered inserts this size will be incorrect, but knowing the batch | ||
// size isn't needed for ordered failures since we | ||
// return immediately from them anyways. | ||
let current_batch_size = bw.inserted_ids.len() | ||
+ bw.write_errors.as_ref().map(|we| we.len()).unwrap_or(0); | ||
|
||
let failure_ref = | ||
cumulative_failure.get_or_insert_with(BulkWriteFailure::new); | ||
if let Some(write_errors) = bw.write_errors { | ||
for err in write_errors { | ||
let index = n_attempted + err.index; | ||
|
||
failure_ref | ||
.write_errors | ||
.get_or_insert_with(Default::default) | ||
.push(BulkWriteError { index, ..err }); | ||
Err(e) => { | ||
let labels = e.labels().clone(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Github diff is misleading here - the only change is cloning the labels before the match to accommodate the |
||
match *e.kind { | ||
ErrorKind::BulkWrite(bw) => { | ||
// for ordered inserts this size will be incorrect, but knowing the | ||
// batch size isn't needed for ordered | ||
// failures since we return immediately from | ||
// them anyways. | ||
let current_batch_size = bw.inserted_ids.len() | ||
+ bw.write_errors.as_ref().map(|we| we.len()).unwrap_or(0); | ||
|
||
let failure_ref = | ||
cumulative_failure.get_or_insert_with(BulkWriteFailure::new); | ||
if let Some(write_errors) = bw.write_errors { | ||
for err in write_errors { | ||
let index = n_attempted + err.index; | ||
|
||
failure_ref | ||
.write_errors | ||
.get_or_insert_with(Default::default) | ||
.push(BulkWriteError { index, ..err }); | ||
} | ||
} | ||
} | ||
|
||
if let Some(wc_error) = bw.write_concern_error { | ||
failure_ref.write_concern_error = Some(wc_error); | ||
} | ||
|
||
error_labels.extend(e.labels); | ||
if let Some(wc_error) = bw.write_concern_error { | ||
failure_ref.write_concern_error = Some(wc_error); | ||
} | ||
|
||
if ordered { | ||
// this will always be true since we invoked get_or_insert_with above. | ||
if let Some(failure) = cumulative_failure { | ||
return Err(Error { | ||
kind: Box::new(ErrorKind::BulkWrite(failure)), | ||
labels: error_labels, | ||
}); | ||
error_labels.extend(labels); | ||
|
||
if ordered { | ||
// this will always be true since we invoked get_or_insert_with | ||
// above. | ||
if let Some(failure) = cumulative_failure { | ||
return Err(Error::new( | ||
ErrorKind::BulkWrite(failure), | ||
Some(error_labels), | ||
)); | ||
} | ||
} | ||
n_attempted += current_batch_size; | ||
} | ||
n_attempted += current_batch_size; | ||
_ => return Err(e), | ||
} | ||
_ => return Err(e), | ||
}, | ||
} | ||
} | ||
} | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not super thrilled about the behavior here but I can't think of a clean solution.
TestClient
andEventClient
have awith_additional_options
constructor fn that, semantically, takes a passed-inClientOptions
and merges in the set of "test-default" options there for any unset fields, with preference given to the passed-in fields where both were set.hosts
was not included in the merge, so the passed-inClientOptions
would always determinehosts
. This caused thelabel_not_added_first_read_error
/label_not_added_second_read_error
tests to break on serverless because those tests were not settinghosts
and the default value was not valid in those cases.hosts
would be the same as for the rest of the fields - if unset, it would use the "test default". However, because it's populated in the builder by default, there's no way to actually determine "if unset"; testing against the default value causes other tests to fail because those are specifically constructing a hosts vec that, coincidentally, is equal to the default value, and should not be overridden by the test default.hosts
to anOption<Vec<_>>
or not populating it by default sovec[]
would be a reasonable signal for "unset", but either of those would be a breaking change.with_additional_options
with aClientOptions
constructed via builder with the default hosts is a nasty pitfall that's easy to hit - from the call site it looks like you'll be constructing a client with only the options specified, and the defaulthosts
value will coincidentally work in most but not all testing environments.hosts
or copying theClientOptions
from theCLIENT_OPTIONS
value.