Skip to content

[CDRIVER-4540] Define a success test for CreateEncryptedCollection #1176

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

Conversation

vector-of-bool
Copy link
Contributor

Creates an encrypted collection using the CEC API, then uses the generated key to encrypt a value, and then inserts that value into the new encrypted collection. Expects success.

Creates an encrypted collection using the CEC API, then uses the
generated key to encrypt a value, and then inserts that value into the
new encrypted collection. Expects success.
Copy link
Contributor

@eramongodb eramongodb left a comment

Choose a reason for hiding this comment

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

Minor feedback; otherwise, LGTM.

Comment on lines +6436 to +6439
mongoc_collection_drop (coll, &error);
bool okay =
error.code == 0 || strstr (error.message, "ns not found") != NULL;
ASSERT_OR_PRINT (okay, error);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this just be (void)mongoc_collection_drop(...); as done in some other tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Potentially, but any error other than "ns not found" will indicate that the remainder of the test will likely also fail.

bson_value_t plain;
plain.value_type = BSON_TYPE_UTF8;
plain.value.v_utf8.str = "123-45-6789";
plain.value.v_utf8.len = strlen (plain.value.v_utf8.str);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
plain.value.v_utf8.len = strlen (plain.value.v_utf8.str);
plain.value.v_utf8.len = (uint32_t) strlen (plain.value.v_utf8.str);

Address -Wshorten-64-to-32 warnings.

visitEach (require (type (doc)),
parse (require (key ("keyId"),
require (type (binary)),
do({
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
do({
do ({

ClangFormat.

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 appears to be a behavior change in Clang 16 :(

@vector-of-bool vector-of-bool merged commit a8560d7 into mongodb:master Jan 13, 2023
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