Skip to content

GODRIVER-3880 Skip QE "prefixPreview" and "suffixPreview" tests on server 9.0.0+.#2378

Open
qingyang-hu wants to merge 3 commits intomongodb:masterfrom
qingyang-hu:godriver3880
Open

GODRIVER-3880 Skip QE "prefixPreview" and "suffixPreview" tests on server 9.0.0+.#2378
qingyang-hu wants to merge 3 commits intomongodb:masterfrom
qingyang-hu:godriver3880

Conversation

@qingyang-hu
Copy link
Copy Markdown
Contributor

GODRIVER-3880

Summary

  • Skip QE prose tests of "prefixPreview" and "suffixPreview" on server 9.0.0+

Background & Motivation

@mongodb-drivers-pr-bot
Copy link
Copy Markdown
Contributor

mongodb-drivers-pr-bot Bot commented May 4, 2026

🧪 Performance Results

Commit SHA: 621e841

The following benchmark tests for version 69fa6985b3404400074bd712 had statistically significant changes (i.e., |z-score| > 1.96):

Benchmark Measurement % Change Patch Value Stable Region H-Score Z-Score
BenchmarkLargeDocInsertOne ops_per_second_min 49.4053 1934.3931 Avg: 1294.7283
Med: 1272.5091
Stdev: 279.4260
0.7765 2.2892
BenchmarkSingleRunCommand total_time_seconds -4.9564 1.0835 Avg: 1.1400
Med: 1.1364
Stdev: 0.0271
0.7582 -2.0879

For a comprehensive view of all microbenchmark results for this PR's commit, please check out the Evergreen perf task for this patch.

@mongodb-drivers-pr-bot
Copy link
Copy Markdown
Contributor

API Change Report

No changes found!

@qingyang-hu qingyang-hu marked this pull request as ready for review May 5, 2026 15:53
@qingyang-hu qingyang-hu requested a review from a team as a code owner May 5, 2026 15:53
@qingyang-hu qingyang-hu requested review from Copilot and matthewdale May 5, 2026 15:53
Copy link
Copy Markdown
Contributor

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 updates the QE prose test for text explicit encryption so prefix/suffix-specific cases are skipped on MongoDB 9.0+ while substring coverage continues to run. It fits into the client-side encryption integration suite by narrowing version applicability for server features that are no longer expected to work on newer servers.

Changes:

  • Reworks encrypted collection setup to build the list of test collections conditionally by server version.
  • Gates the prefix/suffix query subtests to run only on server versions below 9.0.
  • Leaves substring query coverage enabled across supported server versions.
Comments suppressed due to low confidence (1)

internal/integration/client_side_encryption_prose_test.go:3452

  • This version gate removes the only coverage for the "contention factor is required" validation on 9.0+, even though substringPreview is still exercised on those servers in Cases 5 and 6. Please keep this assertion running on supported servers (for example by using substringPreview) so the validation doesn't become untested on 9.0+.
	mt.RunOpts("Case 7: assert contentionFactor is required", mtest.NewOptions().MaxServerVersion("8.99.99"), func(mt *mtest.T) {
		encryptedClient, clientEncryption := testSetup()
		defer clientEncryption.Close(context.Background())
		defer encryptedClient.Disconnect(context.Background())

		eo := options.Encrypt().
			SetKeyID(key1ID).
			SetAlgorithm("TextPreview").
			SetQueryType("prefixPreview").

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +3150 to +3151
name: "substring",
fields: readJSONFile(mt, "encryptedFields-substring.json"),
Comment on lines +3137 to +3144
if mtest.CompareServerVersions(mtest.ServerVersion(), "9.0.0") < 0 {
encryptedColls = append(encryptedColls, struct {
name string
fields bson.Raw
}{
name: "prefix-suffix",
fields: readJSONFile(mt, "encryptedFields-prefix-suffix.json"),
})
@qingyang-hu qingyang-hu marked this pull request as draft May 5, 2026 16:05
Copy link
Copy Markdown
Contributor

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

assert.ErrorIs(mt, err, mongo.ErrNoDocuments)
})
mt.Run("Case 7: assert contentionFactor is required", func(mt *mtest.T) {
mt.RunOpts("Case 7: assert contentionFactor is required", mtest.NewOptions().MaxServerVersion("8.99.99"), func(mt *mtest.T) {
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.

These commands will change to non-preview on 9.0+, so these tests will not be relevant for 9.0+.

Comment on lines +3174 to +3175
if coll.name == "prefix-suffix" && mtest.CompareServerVersions(mtest.ServerVersion(), "9.0.0") >= 0 {
continue
@qingyang-hu qingyang-hu marked this pull request as ready for review May 6, 2026 13:32
Copy link
Copy Markdown
Contributor

@matthewdale matthewdale 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! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants