Use dedicated port for peer listener when testing.

This commit is contained in:
Joachim Bauch 2023-12-01 23:33:33 +01:00
parent 716be91feb
commit dddf194b48
No known key found for this signature in database
GPG key ID: 77C1D22D53E15F02

View file

@ -83,6 +83,9 @@ func newEtcdForTesting(t *testing.T) *embed.Etcd {
httpListener := u
httpListener.Host = net.JoinHostPort("localhost", strconv.Itoa(port+1))
cfg.ListenClientHttpUrls = []url.URL{*httpListener}
peerListener := u
peerListener.Host = net.JoinHostPort("localhost", strconv.Itoa(port+2))
cfg.ListenPeerUrls = []url.URL{*peerListener}
etcd, err = embed.StartEtcd(cfg)
if isErrorAddressAlreadyInUse(err) {
continue