Skip to content
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: fix MustNewMember #18584

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions tests/framework/integration/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -1693,5 +1693,20 @@ func (c *Cluster) MustNewMember(t testutil.TB, resp *clientv3.MemberAddResponse)
}
m.InitialPeerURLsMap[m.Name] = types.MustNewURLs(resp.Member.PeerURLs)
c.Members = append(c.Members, m)

// c.mustNewMember(t) creates a new member without using resp.Member.PeerURLs.
// We should override PeerURLs and PeerListeners set by mustNewMember.
urls := types.MustNewURLs(resp.Member.PeerURLs)
m.PeerURLs = urls
var listeners []net.Listener
for _, url := range urls {
l, err := transport.NewListener(url.Host, url.Scheme, nil)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last parameter always nil? What if it's HTTPS communication?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added tlsinfo *transport.TLSInfo param to MustNewMember() in case callers need it.

if err != nil {
t.Fatal("failed to listen on %v: %v", url, err)
}
listeners = append(listeners, l)
}
m.PeerListeners = listeners

return m
}
Loading