mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
fix(tests/discovery): use host as -peers parameter instead of url
Or it cannot test the functionality correctly. Moreover, add TestDiscoveryNoWithBackupPeers as the test for it.
This commit is contained in:
@@ -94,6 +94,16 @@ func (r *Registry) clientURL(name string) (string, bool) {
|
||||
return "", false
|
||||
}
|
||||
|
||||
// Retrieves the host part of peer URL for a given node by name.
|
||||
func (r *Registry) PeerHost(name string) (string, bool) {
|
||||
rawurl, ok := r.PeerURL(name)
|
||||
if ok {
|
||||
u, _ := url.Parse(rawurl)
|
||||
return u.Host, ok
|
||||
}
|
||||
return rawurl, ok
|
||||
}
|
||||
|
||||
// Retrieves the peer URL for a given node by name.
|
||||
func (r *Registry) PeerURL(name string) (string, bool) {
|
||||
r.Lock()
|
||||
|
||||
Reference in New Issue
Block a user