Skip to content

chore: remove deprecated API, simplify test infrastructure#307

Open
meling wants to merge 18 commits intofeature/299/update-all-callersfrom
chore/300/regenerate-gorums-proto
Open

chore: remove deprecated API, simplify test infrastructure#307
meling wants to merge 18 commits intofeature/299/update-all-callersfrom
chore/300/regenerate-gorums-proto

Conversation

@meling
Copy link
Member

@meling meling commented Mar 25, 2026

Summary

Final cleanup of the API surface after the stacked refactors in #295#299.

Removes all remaining deprecated symbols and simplifies the test infrastructure:

  • Remove NewManager (use NewConfig instead)
  • Remove NewConfiguration (use NewConfig instead)
  • Remove Manager type alias (was = outboundManager)
  • Remove WithManager test option and existingCfg field from testOptions
  • Remove getOrCreateManager helper; TestConfiguration now calls NewConfig directly and registers t.Cleanup(Closer(t, cfg))
  • Add TestDialOptions(t) DialOption (build-tag-aware) for use in tests that call NewConfig directly
  • Replace withRequestHandler (internal) with WithServer in all test files
  • Rename TestNewConfigurationTestNewConfig
  • Update doc comments, doc/user-guide.md, and stale backward-compatibility comments in node.go
  • Regenerate *_gorums.pb.go files to remove Manager wrappers from generated templates

Related

Part of #294
Closes #300

meling added 18 commits March 24, 2026 18:01
This removes from generated code:
- Manager type
- NewManager function
- NewConfiguration function

And updates the NewConfig signature to enforce better type safety
regarding which options are allowed and in which order.
Add TestDialOptions(t testing.TB) DialOption with two build-tag
implementations: bufconn mode (testing_bufconn.go) creates an
indirect in-memory dialer via globalBufconnRegistry; integration mode
(testing_integration.go) delegates to InsecureDialOptions.

Move getOrCreateManager from both build-tag files into testing_shared.go
as a single implementation that calls TestDialOptions(t); removes the
duplicated setup logic. TestManager is updated to reflect the unified
approach.

Replace NewConfiguration(mgr, ...) in TestConfiguration with the
internal newConfig(mgr) call, removing the last test helper use of
the deprecated NewConfiguration function.
Convert all TestManager + NewConfiguration pairs in inbound_manager_test.go
to use NewConfig(WithNodeList(addrs), TestDialOptions(t), ...) directly.

Change connectAsPeer and connectAsPeerClient return types from
*outboundManager to Configuration; callers that previously called
mgr.Close() now call cfg.Close(). Cleanup is registered via t.Cleanup
in the helpers, consistent with the rest of the test suite.
Replace all withRequestHandler calls in inbound_manager_test.go with
the public WithServer API. In TestKnownPeerServerCallsClient, the
mockRequestHandler type is removed and replaced with a real *Server
with RegisterHandler calls, which is the idiomatic way to set up a
back-channel handler. Update doc comments in connectAsPeerClient to
reference WithServer instead of withRequestHandler.
Replace the stale gorums.NewManager example in the TestServers doc
comment with the current pattern using gorums.NewConfig together with
gorums.TestDialOptions.

Rename mgrOption to dialOption and mgrNodes to cfgNodes.
Replace all NewManager + NewConfiguration pairs with gorums.NewConfig.
Update prose in the "Implementing the StorageClient" section to no
longer describe the Manager type, since it is unexported; the entry
point is now NewConfig.

Update "Working with Configurations" example to use the current
Configuration methods: Extend, Union, Difference, Remove, and
WithoutErrors as direct method calls (returns Configuration, no error)
instead of the old NewConfiguration wrapper pattern.
Replace the removed methods And, Except, WithoutNodes, and WithNewNodes
with their current equivalents.

Fixed nil return for error cases in WriteNestedMulticast.
This avoids the need for WithManager to create new configurations using
the same manager; instead we create one large configuration and remove
from it to create other configurations using Union and Difference.
Remove WithManager, existingCfg field, and getOrCreateManager from the
testing infrastructure. TestConfiguration now calls NewConfig and
registers t.Cleanup(Closer(t, cfg)) using the returned configuration,
which owns and closes its manager internally.
@deepsource-io
Copy link
Contributor

deepsource-io bot commented Mar 25, 2026

DeepSource Code Review

We reviewed changes in 50924a6...1f958ec on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
Go Mar 25, 2026 7:56a.m. Review ↗
Shell Mar 25, 2026 7:56a.m. Review ↗

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