Skip to content

RUST-1859 Sync bulk write spec tests #1106

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 7 commits into from
May 17, 2024
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 1 addition & 5 deletions src/operation/distinct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,9 @@ impl OperationWithDefaults for Distinct {
let mut body = rawdoc! {
Self::NAME: self.ns.coll.clone(),
"key": self.field_name.clone(),
"query": RawDocumentBuf::from_document(&self.query)?,
};

if !self.query.is_empty() {
let raw_query: RawDocumentBuf = (&self.query).try_into()?;
body.append("query", raw_query);
}

append_options_to_raw_document(&mut body, self.options.as_ref())?;

Ok(Command::new_read(
Expand Down
2 changes: 2 additions & 0 deletions src/operation/insert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ impl<'a> OperationWithDefaults for Insert<'a> {
const NAME: &'static str = "insert";

fn build(&mut self, description: &StreamDescription) -> Result<Command> {
self.inserted_ids.clear();
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Caught by a retryable writes test, we were adding duplicates here upon retry


let max_doc_size: usize = Checked::new(description.max_bson_object_size).try_into()?;
let max_message_size: usize =
Checked::new(description.max_message_size_bytes).try_into()?;
Expand Down
9 changes: 0 additions & 9 deletions src/test/bulk_write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use crate::{
test::{
get_client_options,
log_uncaptured,
spec::unified_runner::run_unified_tests,
util::fail_point::{FailPoint, FailPointMode},
},
Client,
Expand Down Expand Up @@ -40,14 +39,6 @@ impl PartialBulkWriteResult {
}
}

#[tokio::test(flavor = "multi_thread")]
async fn run_unified() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are now run in crud::run_unified

run_unified_tests(&["crud", "unified", "new-bulk-write"])
// TODO RUST-1405: unskip this test
.skip_files(&["client-bulkWrite-errorResponse.json"])
.await;
}

// CRUD prose test 3
#[tokio::test]
async fn max_write_batch_size_batching() {
Expand Down
1 change: 0 additions & 1 deletion src/test/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ mod collection_management;
mod command_monitoring;
mod connection_stepdown;
mod crud;
mod crud_v1;
mod faas;
mod gridfs;
mod index_management;
Expand Down
6 changes: 6 additions & 0 deletions src/test/spec/command_monitoring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ use crate::test::spec::unified_runner::run_unified_tests;
#[tokio::test(flavor = "multi_thread")]
async fn command_monitoring_unified() {
run_unified_tests(&["command-logging-and-monitoring", "monitoring"])
.skip_files(&[
// TODO RUST-1599: Unskip this file
"find.json",
// The driver does not support unacknowledged writes.
"unacknowledged-client-bulkWrite.json",
])
.skip_tests(&[
// This test relies on old OP_QUERY behavior that many drivers still use for < 4.4, but
// we do not use, due to never implementing OP_QUERY.
Expand Down
8 changes: 8 additions & 0 deletions src/test/spec/crud.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ async fn run_unified() {
"replaceOne-hint-unacknowledged.json",
"updateMany-hint-unacknowledged.json",
"updateOne-hint-unacknowledged.json",
// TODO RUST-1405: unskip the errorResponse tests
"client-bulkWrite-errorResponse.json",
"bulkWrite-errorResponse.json",
"updateOne-errorResponse.json",
"insertOne-errorResponse.json",
"deleteOne-errorResponse.json",
"aggregate-merge-errorResponse.json",
"findOneAndUpdate-errorResponse.json",
])
.skip_tests(&[
// Unacknowledged write; see above.
Expand Down
90 changes: 0 additions & 90 deletions src/test/spec/crud_v1.rs

This file was deleted.

92 changes: 0 additions & 92 deletions src/test/spec/crud_v1/aggregate.rs

This file was deleted.

77 changes: 0 additions & 77 deletions src/test/spec/crud_v1/count.rs

This file was deleted.

Loading