replace test_setup* with a builder #9446
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This replaces
nexus_test_utils::test_setupandnexus_test_utils::test_setup_with_configwith a builder-style interface instead, updating all callers to use it. Most tests today do not need to customize anything and they use thenexus_testmacro (also updated in this PR). The other callers here are either customizing the tokio environment (the update tests do this to adjust the number of worker threads for their test) or something about the control plane configuration (either the config file or other arguments passed totest_setup_with_config).Previously, we had:
test_setup, which accepted a test name and a number of "extra" sled agents.test_setup_with_config, which accepted these, plus a whole parsed Nexus config file and a bunch of other Rust properties (TLS certificate, sim-sled-agent simulation mode, etc.)This was sort of a weird middle ground:
test_setupwas supposed to be the simplest one for the stock defaults, but it still made you specify the number of extra sled agents.test_setup_with_configlets you control everything, but had the usual problem of functions with lots of arguments:This fixes all of that by providing a builder whose defaults match what you used to get with
#[nexus_test], but where you can customize any of these individually without worrying about any others. You don't have to specify anything when you want a default.The real motivation for this change is that I want to add a new thing you can customize here (for the new debug dropbox) and I didn't want to keep adding new arguments to
test_setup_with_configthat everybody has to deal with.Staged on top of #9445.