Repository navigation
gorums: add per-server options for local server groups - #361
Merged
Merged
Conversation
meling
added this pull request to stack #362
October 11, 2026 20:40
NewLocalServers applied the same server and dial options to every server, so a local cluster could not give each server its own TLS certificate. Add WithLocalServerOptionsFunc and WithLocalDialOptionsFunc, which return the options for a server's node ID. They are applied after the shared options, so per-server transport credentials replace shared ones.
LocalServers took only server options, so a test could not give its servers per-server options or extra dial options. It now takes the package's Option type: a ServerOption applies to every server, a DialOption to every server's outbound configuration after DialOptions, and a LocalServerOption, such as WithLocalServerOptionsFunc, as given. Other types panic, as for Config and Node.
LocalServers built its options, which register the listeners' cleanup through servers.ListenFunc, before it registered goleak.VerifyNone. Cleanups run in reverse order, so the leak check ran before the listeners were cleaned up, contrary to the comment that the check runs last. Register the leak check first.
meling
force-pushed
the
feat/325/local-server-options
branch
from
October 12, 2026 20:10
442e7a9 to
88fcd3e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Part of #325; the base of a stack: this PR, then #359 (peer identity), then #360 (refused-stream retry).
Summary
Test infrastructure for local server groups whose servers need different options, for example each its own TLS certificate.
gorums: add per-server options to NewLocalServers—WithLocalServerOptionsFunc(fn func(id ID) []ServerOption)andWithLocalDialOptionsFunc(fn func(id ID) []DialOption)apply the options thatfnreturns for a server's node ID, after the shared options, so per-server transport credentials replace shared ones.gorumstest: accept local server and dial options in LocalServers—LocalServers(t, n, opts ...gorumstest.Option)now routes aServerOptionto every server, aDialOptionto every server's outbound configuration afterDialOptions(t), and aLocalServerOption(such asWithLocalServerOptionsFunc) as given; other types panic, as forConfigandNode.Callers that spread a
[]gorums.ServerOptionmust use a[]gorumstest.Optionslice; the four call sites in this repository are updated.gorumstest: register the leak check before the listeners' cleanup— restores the documented cleanup order, sogoleak.VerifyNoneruns after the listeners' cleanup.Testing
TestLocalServersAppliesPerServerOptions,TestLocalServersOptions, andTestLocalServersUnsupportedOption;make testandmake integrationtestpass on this branch alone.