-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests and foundations for new cluster peer discovery #1311
Conversation
5b78f1d
to
15e8037
Compare
15e8037
to
6c31bc4
Compare
switch { | ||
case len(opts.JoinPeers) > 0 && opts.DiscoverPeers != "": | ||
return nil, fmt.Errorf("at most one of join peers and discover peers may be set") | ||
|
||
case len(opts.JoinPeers) > 0: | ||
config.DiscoverPeers = newStaticDiscovery(opts.JoinPeers, listenPort, opts.Log) | ||
|
||
case opts.DiscoverPeers != "": | ||
discoverFunc, err := newDynamicDiscovery(config.Log, opts.DiscoverPeers, listenPort) | ||
if err != nil { | ||
return nil, err | ||
} | ||
config.DiscoverPeers = discoverFunc | ||
|
||
default: | ||
// Here, both JoinPeers and DiscoverPeers are empty. This is desirable when | ||
// starting a seed node that other nodes connect to, so we don't require | ||
// one of the fields to be set. | ||
default: | ||
// Here, both JoinPeers and DiscoverPeers are empty. This is desirable when | ||
// starting a seed node that other nodes connect to, so we don't require | ||
// one of the fields to be set. | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diff doesn't make it easy to see that this else
is basically the original cluster peer discovery code.
"github.com/go-kit/log" | ||
) | ||
|
||
func TestPeerDiscovery(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests help to highlight some of the issues that I want to address on top of using A records in the follow-up PR.
The `--cluster.use-discovery-v1` flag can be used to switch back to the older, v1 version of the cluster peer discovery mechanism | ||
in case of any issues with the newer version. This flag will be deprecated in the future and eventually removed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I add support for A records, I will add here a note about what differences are between these mechanisms in the follow-up PR.
I will also add something to CHANGELOG.md once we actually have functional changes - this PR doesn't make any behaviour changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, the new structure and the tests are great. The code duplication is not ideal but it's only temporary
5a0900c
to
920382e
Compare
920382e
to
d722910
Compare
This reverts commit 020713c.
PR Description
As part of this issue investigation: #1208 we found that there are missing tests and a few inconsistencies in the way that cluster peer discovery currently works.
Since this is a critical feature used by large scale users, we want to ensure that these are well-tested paths and bugs and inconsistencies are eliminated.
In order to isolate these changes and future refactoring, this PR:
This sets a foundation for further changes:
PR Checklist