Skip to content

Conversation

isabelatkinson
Copy link
Contributor

@isabelatkinson isabelatkinson commented Mar 4, 2025

RUST-1447

Removes all server round-trips from test client creation and instead caches client metadata in a number of lazy static variables in src/test.rs. The changes outside of src/test.rs and src/test/util.rs are largely search-and-replace; I also removed some checks related to 4.0 now that we don't support/test any lower server versions.

@isabelatkinson
Copy link
Contributor Author

windows failures are unrelated, I'm investigating and will fix in a separate PR

@isabelatkinson isabelatkinson marked this pull request as ready for review March 4, 2025 19:23
@isabelatkinson isabelatkinson requested a review from abr-egn March 4, 2025 19:23
src/test.rs Outdated
}

async fn get_server_version() -> &'static semver::Version {
static SERVER_VERSION: OnceCell<semver::Version> = OnceCell::const_new();
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if it might be better to bundle the static values into a single struct with a single lazy initializer; as it is a new Client has to be constructed for each group of related functions and that would collapse it down to a single one.

This is well into micro-optimization territory, though, so up to you if you want to implement that or merge as-is :)

@isabelatkinson isabelatkinson merged commit 799f323 into mongodb:main Mar 6, 2025
12 of 16 checks passed
@isabelatkinson isabelatkinson deleted the cache-client-metadata branch March 17, 2025 19:30
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.

2 participants