Skip to content

DRIVERS-3470 case and diacritic text explicit encryption tests#1931

Open
mdb-ad wants to merge 11 commits into
mongodb:masterfrom
mdb-ad:case-tests
Open

DRIVERS-3470 case and diacritic text explicit encryption tests#1931
mdb-ad wants to merge 11 commits into
mongodb:masterfrom
mdb-ad:case-tests

Conversation

@mdb-ad
Copy link
Copy Markdown
Contributor

@mdb-ad mdb-ad commented May 5, 2026

Background

Tests case and diacritic insensitivity. Also serves as a regression test for MONGOCRYPT-903. Note: the fix was released in libmongocrypt 1.18.1

Test implementation

Unlike other text prose tests, the new case and diacritic tests use automatic encryption to insert the test document. This is because the libmongocrypt bug reversed case and diacritic sensitivity both on the insert and find, causing the tests to pass.

C driver implementation: mongodb/mongo-c-driver#2289
Evergreen patch (C driver): https://spruce.corp.mongodb.com/version/69fe3b156c09fa0007dd4f45
Libmongocrypt build (for drivers testing): https://spruce.corp.mongodb.com/version/libmongocrypt_d64db0ad9db89b8ba85e6330133e2df55b5eb9ff

@mdb-ad mdb-ad requested a review from kevinAlbs May 5, 2026 18:20
@mdb-ad mdb-ad requested a review from a team as a code owner May 5, 2026 18:20
Comment thread source/client-side-encryption/tests/README.md Outdated
@mdb-ad mdb-ad requested a review from kevinAlbs May 5, 2026 19:45
@mdb-ad mdb-ad requested a review from a team as a code owner May 8, 2026 19:49
Copy link
Copy Markdown
Contributor

@kevinAlbs kevinAlbs left a comment

Choose a reason for hiding this comment

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

Nice, LGTM with additional notes to skip server 9.0.0+ and require libmongocrypt 1.18.1.

Expect an error from libmongocrypt with a message containing the string: "contention factor is required for textPreview
algorithm".

#### Case 8: can find a case and diacritic-insensitively indexed document by prefix and suffix
Copy link
Copy Markdown
Contributor

@kevinAlbs kevinAlbs May 8, 2026

Choose a reason for hiding this comment

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

Also note: "Skip this test case if testing MongoDB server 9.0.0+." note (similar to Case 7) to cases 8 and 9 (requiring prefixPreview and suffixPreview).

And note that libmongocrypt 1.18.1 is required for test cases 8 and 9 since those are regression tests for MONGOCRYPT-903.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1

@kevinAlbs kevinAlbs requested a review from rozza May 8, 2026 20:36
@rozza
Copy link
Copy Markdown
Member

rozza commented May 18, 2026

I'm gonna have to wait for JAVA-6187 to land before being able to test this with Java.
So recommend grabbing another set of eyes from a driver that already uses 1.18.0+

@kevinAlbs kevinAlbs requested review from adelinowona and removed request for rozza May 18, 2026 20:07
Comment thread source/client-side-encryption/tests/README.md Outdated
Comment thread source/client-side-encryption/tests/README.md Outdated
Expect an error from libmongocrypt with a message containing the string: "contention factor is required for textPreview
algorithm".

#### Case 8: can find a case and diacritic-insensitively indexed document by prefix and suffix
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1

@mdb-ad mdb-ad requested a review from kevinAlbs May 22, 2026 18:09
Read the `"_id"` field of `key1Document` as `key1ID`.

Load the file
[key2-document.json](https://github.com/mongodb/specifications/tree/master/source/client-side-encryption/etc/data/keys/key2-document.json)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

key2-document is referenced in other tests (e.g. fle2v2-Compact). Regenerating those test files might have unintended changes.

Rather than have the substring test use two fields in the same schema (which requires two keys due to QE needing a unique key-per-field), I suggest following the pattern with prefix-suffix. Add another schema: encryptedFields-substring-ci-di.json to test the insensitive cases.


#### Case 8: can find a case and diacritic-insensitively indexed document by prefix and suffix

Skip this test case if testing MongoDB server 9.0.0+.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
Skip this test case if testing MongoDB server 9.0.0+.
Skip this test case if testing MongoDB server 9.0.0+. This test requires libmongocrypt 1.18.1+.


#### Case 9: can find a diacritic-insensitively indexed document by prefix and suffix

Skip this test case if testing MongoDB server 9.0.0+.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
Skip this test case if testing MongoDB server 9.0.0+.
Skip this test case if testing MongoDB server 9.0.0+. This test requires libmongocrypt 1.18.1+.

{ "encryptedText": "cafébarbäz" }
```

#### Case 10: can find a case-insensitively indexed document by substring
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
#### Case 10: can find a case-insensitively indexed document by substring
#### Case 10: can find a case-insensitively indexed document by substring
This test requires libmongocrypt 1.18.1+.

{ "encryptedTextInsensitive": "FooBarBaz" }
```

#### Case 11: can find a diacritic-insensitively indexed document by substring
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
#### Case 11: can find a diacritic-insensitively indexed document by substring
#### Case 11: can find a diacritic-insensitively indexed document by substring
This test requires libmongocrypt 1.18.1+.

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