Skip to content

Commit

Permalink
add tlsinfo arg to MustNewMember() function
Browse files Browse the repository at this point in the history
Signed-off-by: Clement <[email protected]>
  • Loading branch information
clement2026 committed Sep 13, 2024
1 parent f496ee8 commit d975a1e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions tests/framework/integration/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -1682,7 +1682,8 @@ func (p SortableProtoMemberSliceByPeerURLs) Less(i, j int) bool {
func (p SortableProtoMemberSliceByPeerURLs) Swap(i, j int) { p[i], p[j] = p[j], p[i] }

// MustNewMember creates a new member instance based on the response of V3 Member Add API.
func (c *Cluster) MustNewMember(t testutil.TB, resp *clientv3.MemberAddResponse) *Member {
// Pass nil for tlsinfo if the member's PeerURLs don't use HTTPS.
func (c *Cluster) MustNewMember(t testutil.TB, resp *clientv3.MemberAddResponse, tlsinfo *transport.TLSInfo) *Member {
m := c.mustNewMember(t)
m.IsLearner = resp.Member.IsLearner
m.NewCluster = false
Expand All @@ -1700,7 +1701,7 @@ func (c *Cluster) MustNewMember(t testutil.TB, resp *clientv3.MemberAddResponse)
m.PeerURLs = urls
var listeners []net.Listener
for _, url := range urls {
l, err := transport.NewListener(url.Host, url.Scheme, nil)
l, err := transport.NewListener(url.Host, url.Scheme, tlsinfo)
if err != nil {
t.Fatal("failed to listen on %v: %v", url, err)
}
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/clientv3/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ func TestMemberPromote(t *testing.T) {

// create and launch learner member based on the response of V3 Member Add API.
// (the response has information on peer urls of the existing members in cluster)
learnerMember := clus.MustNewMember(t, memberAddResp)
learnerMember := clus.MustNewMember(t, memberAddResp, nil)

if err = learnerMember.Launch(); err != nil {
t.Fatal(err)
Expand Down

0 comments on commit d975a1e

Please sign in to comment.