diff --git a/dm/master/server.go b/dm/master/server.go index d5fe4036ad..885408846a 100644 --- a/dm/master/server.go +++ b/dm/master/server.go @@ -1838,9 +1838,16 @@ func (s *Server) listMemberMaster(ctx context.Context, names []string) (*pb.Memb etcdMembers := memberList.Members masters := make([]*pb.MasterInfo, 0, len(etcdMembers)) - client := http.Client{ - Timeout: 1 * time.Second, + + client := &http.Client{} + if len(s.cfg.SSLCA) != 0 { + inner, err := toolutils.ToTLSConfigWithVerify(s.cfg.SSLCA, s.cfg.SSLCert, s.cfg.SSLKey, s.cfg.CertAllowedCN) + if err != nil { + return resp, err + } + client = toolutils.ClientWithTLS(inner) } + client.Timeout = 1 * time.Second for _, etcdMember := range etcdMembers { if !all && !set[etcdMember.Name] { diff --git a/tests/tls/run.sh b/tests/tls/run.sh index e3a71fb92b..ad745bdb41 100644 --- a/tests/tls/run.sh +++ b/tests/tls/run.sh @@ -81,6 +81,11 @@ function run() { "\"result\": true" 2 \ "\"source\": \"$SOURCE_ID1\"" 1 + echo "check master alive" + run_dm_ctl_with_tls $WORK_DIR "127.0.0.1:$MASTER_PORT" $cur/conf/ca.pem $cur/conf/dm.pem $cur/conf/dm.key \ + "list-member" \ + "\"alive\": true" 3 + echo "start task and check stage" run_dm_ctl_with_tls $WORK_DIR "127.0.0.1:$MASTER_PORT" $cur/conf/ca.pem $cur/conf/dm.pem $cur/conf/dm.key \ "start-task $WORK_DIR/dm-task.yaml" \