Skip to content
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-1387 Execute CSFLE unified spec tests #770

Merged
merged 10 commits into from
Nov 10, 2022

Conversation

abr-egn
Copy link
Contributor

@abr-egn abr-egn commented Nov 2, 2022

RUST-1387

This updates the unified runner to support csfle tests (mostly just new operations). This PR also pulls in the legacy test files - nothing uses those yet but there didn't seem a reason not to.

@abr-egn abr-egn marked this pull request as ready for review November 2, 2022 18:02
@abr-egn abr-egn requested review from a team and kmahar and removed request for a team November 2, 2022 18:02
@kmahar
Copy link
Contributor

kmahar commented Nov 4, 2022

LGTM mod the outstanding namespace thread so tagging everyone else in!

@@ -271,9 +277,30 @@ pub struct DataKeyOptions {
pub key_material: Option<Vec<u8>>,
}

impl<'de> Deserialize<'de> for DataKeyOptions {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this implementation only used for the spec tests? If so, I think we should move it into the test code per this discussion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Also moved the csfle operation definitions to their own submodule to reduce the need for #[cfg(feature = "csfle")] spam.

@@ -202,6 +204,11 @@ impl ClientEntity {
pub(crate) async fn sync_workers(&self) {
self.client.sync_workers().await;
}

#[allow(dead_code)]
Copy link
Contributor

@isabelatkinson isabelatkinson Nov 7, 2022

Choose a reason for hiding this comment

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

nit: does this have the same effect as #[cfg(feature = "csfle")]? if so I think it's a bit more clear to gate this function behind the feature flag than to allow dead code, that way if it's no longer needed for the csfle tests we know to remove it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@@ -133,6 +134,11 @@ impl RunOnRequirement {
return false;
}
}
if let Some(csfle) = &self.csfle {
if *csfle && std::env::var("KMS_PROVIDERS").is_err() {
Copy link
Contributor

Choose a reason for hiding this comment

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

if csfle is set in the test file, does that mean that KMS_PROVIDERS should be set? or is it valid for one of these values to be set but not the other? if it's the former, perhaps we should panic or log some kind of message here to avoid skipping CSFLE tests silently

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This returning false translates into the normal "client topology not compatible with test" message, so it's not quite silent, but that's an increasingly unhelpful message so I augmented this to return details.

Copy link
Contributor

@patrickfreed patrickfreed left a comment

Choose a reason for hiding this comment

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

Looks good mod one minor suggestion and Isabel's comments

Copy link
Contributor

@patrickfreed patrickfreed left a comment

Choose a reason for hiding this comment

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

LGTM!

@abr-egn abr-egn merged commit 4d6ca0a into mongodb:main Nov 10, 2022
isabelatkinson pushed a commit to isabelatkinson/mongo-rust-driver that referenced this pull request Nov 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants