From d975a1e3613d82cbb14891f710c2d2fbd4843cac Mon Sep 17 00:00:00 2001 From: Clement Date: Fri, 13 Sep 2024 22:32:02 +0800 Subject: [PATCH] add tlsinfo arg to MustNewMember() function Signed-off-by: Clement --- tests/framework/integration/cluster.go | 5 +++-- tests/integration/clientv3/cluster_test.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/framework/integration/cluster.go b/tests/framework/integration/cluster.go index 6c8302ef756..5636f3f9b1d 100644 --- a/tests/framework/integration/cluster.go +++ b/tests/framework/integration/cluster.go @@ -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 @@ -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) } diff --git a/tests/integration/clientv3/cluster_test.go b/tests/integration/clientv3/cluster_test.go index 9ed510108b8..a44923a8766 100644 --- a/tests/integration/clientv3/cluster_test.go +++ b/tests/integration/clientv3/cluster_test.go @@ -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)