Skip to content

Conversation

gagik
Copy link
Contributor

@gagik gagik commented Sep 12, 2025

Very WIP - Will probably need a few iterations

@Copilot Copilot AI review requested due to automatic review settings September 12, 2025 12:54
@gagik gagik requested a review from a team as a code owner September 12, 2025 12:54
@gagik gagik marked this pull request as draft September 12, 2025 12:54
@gagik gagik changed the title chore(e2e-tests): add queryable encryption suffix/prefix/substring tests MONGOSH-1351 WIP chore(e2e-tests): add queryable encryption suffix/prefix/substring tests MONGOSH-1351 Sep 12, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds end-to-end tests for queryable encryption substring, prefix, and suffix search functionality in MongoDB 8.2+. The changes implement comprehensive test coverage for the new substring search features in queryable encryption.

  • Adds new test context for MongoDB 8.2+ substring search features
  • Implements tests for prefix, suffix, and substring search operations with queryable encryption
  • Sets up shared test infrastructure for encrypted collections with substring query support

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


it('allows queryable encryption with substring searches', async function () {
// Insert test data for substring searches
// Insert test data for prefix searches
Copy link
Preview

Copilot AI Sep 12, 2025

Choose a reason for hiding this comment

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

The comment 'Insert test data for prefix searches' is incorrect for a substring search test. It should be 'Insert test data for substring searches'.

Suggested change
// Insert test data for prefix searches
// Insert test data for substring searches

Copilot uses AI. Check for mistakes.

const prefixResults = await shell.executeLine(
'coll.find({$expr: { $and: [{$encStrContains: {substring: "admin_", input: "$data"}}] }}, { __safeContent__: 0 }).toArray()'
);
expect(prefixResults).to.have.length(2);
Copy link
Preview

Copilot AI Sep 12, 2025

Choose a reason for hiding this comment

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

The test expects 2 results but then checks for 3 specific strings. This will cause the test to fail since 'admin_explicit_test.pdf' is the third result but the length assertion expects only 2.

Suggested change
expect(prefixResults).to.have.length(2);
expect(prefixResults).to.have.length(3);

Copilot uses AI. Check for mistakes.

Comment on lines 1054 to 1057
const substringResults = await shell.executeLine(
'coll.find({$expr: { $and: [{$encStrContains: {substring: "user", input: "$data"}}] }}, { __safeContent__: 0 }).toArray()'
);
expect(substringResults).to.have.length(2);
Copy link
Preview

Copilot AI Sep 12, 2025

Choose a reason for hiding this comment

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

The same query is executed twice with identical parameters but different expected result counts (2 vs 3). This is logically inconsistent since the same query should return the same results.

Copilot uses AI. Check for mistakes.

@gagik gagik force-pushed the gagik/qe-substring branch 2 times, most recently from 562f52a to 9958221 Compare September 12, 2025 13:04
@gagik gagik force-pushed the gagik/qe-substring branch from 9958221 to 6a40bdc Compare September 12, 2025 13:05
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.

1 participant