-
Notifications
You must be signed in to change notification settings - Fork 167
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
RUST-1149 Prose tests for change streams. #561
RUST-1149 Prose tests for change streams. #561
Conversation
.await; | ||
new_stream.map(|cs| cs.with_type::<T>()) | ||
})); | ||
// Iterate the loop so the new future gets polled and can register wakers. |
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.
This was the point of wrapping the logic in a loop - there needs to be an underlying future that's been polled rather than just returning Poll::Pending
directly because with the latter this future will never be polled again due to the lack of registered wake conditions.
/// The [`Namespace`] containing the database and collection in which the change occurred. | ||
Namespace(Namespace), | ||
#[derive(Deserialize, Debug, PartialEq, Eq)] | ||
pub struct ChangeStreamEventSource { |
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.
is it possible this could change in the future? if so, we should keep it non_exhaustive
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.
Good call, done.
|
||
let (client, coll, mut stream) = match init_stream("track_resume_token", false).await? { | ||
Some(t) => t, | ||
None => return Ok(()), |
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.
can we log that we're skipping due to topology here? (in the spirit of #523)
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.
init_stream
logs when it returns None :)
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.
overall looks really good, just have a few minor comments
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.
LGTM!
RUST-1149
This implements the prose tests for change streams, with the exception of test 6, which is (a) tricky to observe and (b) essentially guaranteed to be correct by the design of the Rust driver. Some relatively minor updates were required to the change stream implementation as a result of bugs found by these tests.