Skip to content

Conversation

matthewdale
Copy link
Collaborator

Summary

Remove the unused ShareClient mtest option.

Background & Motivation

If ShareClient=true is set, mtest will share the same mongo.Client across all subtests. There are a number of mtest capabilities, like built-in event capture and command capture that do not work correctly if a shared client is used across multiple subtests, which could lead to difficult to diagnose flaky tests or tests that succeed when they should not. That feature is completely unused, so remove it.

@matthewdale matthewdale requested a review from a team as a code owner October 16, 2025 23:18
Copy link
Contributor

@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 removes the unused and potentially problematic ShareClient mtest option. The feature allowed sharing a single mongo.Client across all subtests, but this interfered with built-in event and command capture capabilities, potentially causing flaky or incorrectly passing tests.

  • Removed the ShareClient() option method from the Options API
  • Removed the shareClient field and all related logic from the test runner
  • Simplified client lifecycle management by ensuring each subtest always gets its own client

Reviewed Changes

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

File Description
internal/integration/mtest/options.go Removed the ShareClient() method that configured client sharing behavior
internal/integration/mtest/mongotest.go Removed shareClient field, eliminated client sharing logic in test setup and teardown, and simplified client creation flow

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

Copy link
Contributor

API Change Report

No changes found!

Copy link
Contributor

🧪 Performance Results

Commit SHA: 8e0de1a

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

Benchmark Measurement % Change Patch Value Stable Region H-Score Z-Score
BenchmarkBSONDeepDocumentEncoding ops_per_second_min -71.4977 956.3987 Avg: 3355.5147
Med: 3348.6366
Stdev: 515.0813
0.8855 -4.6577
BenchmarkBSONDeepDocumentDecoding ops_per_second_min 22.5969 2452.3869 Avg: 2000.3665
Med: 2006.1911
Stdev: 170.7201
0.8121 2.6477
BenchmarkBSONDeepDocumentEncoding total_mem_allocs 10.6775 246275.0000 Avg: 222515.9237
Med: 222826.5000
Stdev: 7422.7298
0.8457 3.2009
BenchmarkMultiFindMany ns_per_op -10.4612 2341.0000 Avg: 2614.5082
Med: 2596.0000
Stdev: 126.8252
0.7437 -2.1566
BenchmarkSingleRunCommand total_time_seconds 8.0425 1.2070 Avg: 1.1172
Med: 1.1186
Stdev: 0.0348
0.7842 2.5805
BenchmarkBSONFullDocumentDecoding ops_per_second_min -7.9669 1969.8223 Avg: 2140.3402
Med: 2136.4062
Stdev: 23.9214
0.9351 -7.1283
BenchmarkMultiInsertSmallDocument ns_per_op -7.3910 6105.0000 Avg: 6592.2316
Med: 6582.0000
Stdev: 171.3396
0.8113 -2.8437
BenchmarkBSONFlatDocumentDecoding total_mem_allocs 5.2599 11062272.0000 Avg: 10509488.2857
Med: 10580227.0000
Stdev: 206804.1611
0.8059 2.6730
BenchmarkBSONFlatDocumentDecoding total_bytes_allocated 5.2511 435028528.0000 Avg: 413324379.4286
Med: 416098280.0000
Stdev: 8117471.8615
0.8060 2.6738
BenchmarkBSONFlatDocumentDecoding ns_per_op -4.5902 49945.0000 Avg: 52347.8571
Med: 52194.0000
Stdev: 1065.8790
0.7725 -2.2543
BenchmarkBSONFlatDocumentDecoding ops_per_second_med 4.5395 21472.1292 Avg: 20539.7302
Med: 20508.1930
Stdev: 317.7108
0.8222 2.9347
BenchmarkBSONFlatDocumentDecoding ops_per_second_max 3.9798 22254.8627 Avg: 21403.0621
Med: 21250.8235
Stdev: 242.8735
0.8608 3.5072
BenchmarkSingleRunCommand ops_per_second_max -1.5387 8781.3274 Avg: 8918.5561
Med: 8902.2255
Stdev: 61.4542
0.7939 -2.2330
BenchmarkSmallDocInsertOne allocated_bytes_per_op 0.5158 5688.0000 Avg: 5658.8108
Med: 5660.0000
Stdev: 8.0237
0.8545 3.6379
BenchmarkLargeDocInsertOne allocated_bytes_per_op 0.5005 5688.0000 Avg: 5659.6757
Med: 5660.0000
Stdev: 7.6160
0.8659 3.7191
BenchmarkBSONFlatDocumentEncoding allocated_bytes_per_op -0.1377 6263.0000 Avg: 6271.6356
Med: 6272.0000
Stdev: 3.0709
0.8057 -2.8121
BenchmarkBSONFullDocumentDecoding allocated_bytes_per_op 0.0288 25331.0000 Avg: 25323.6981
Med: 25324.0000
Stdev: 1.9472
0.8776 3.7499
BenchmarkBSONFlatDocumentDecoding allocated_bytes_per_op -0.0087 18051.0000 Avg: 18052.5714
Med: 18052.0000
Stdev: 0.7868
0.7662 -1.9973

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

@matthewdale matthewdale added review-priority-low Low Priority PR for Review: within 3 business days ignore-for-release labels Oct 17, 2025
@matthewdale matthewdale merged commit 53057d2 into mongodb:master Oct 17, 2025
35 of 36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ignore-for-release review-priority-low Low Priority PR for Review: within 3 business days

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants