Skip to content

Commit

Permalink
fix TLS in pd control
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Leung <[email protected]>
  • Loading branch information
rleungx committed Sep 4, 2019
1 parent 7baffcb commit 98bf47e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/pdctl/cluster/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ package cluster_test

import (
"encoding/json"
"io/ioutil"
"os"
"path/filepath"
"strings"
"testing"

Expand All @@ -23,6 +26,7 @@ import (
"github.com/pingcap/pd/server"
"github.com/pingcap/pd/tests"
"github.com/pingcap/pd/tests/pdctl"
ctl "github.com/pingcap/pd/tools/pd-ctl/pdctl"
)

func Test(t *testing.T) {
Expand Down Expand Up @@ -59,6 +63,16 @@ func (s *clusterTestSuite) TestClusterAndPing(c *C) {
c.Assert(json.Unmarshal(output, ci), IsNil)
c.Assert(ci, DeepEquals, cluster.GetCluster())

fname := filepath.Join(os.TempDir(), "stdout")
old := os.Stdout
temp, _ := os.Create(fname)
os.Stdout = temp
ctl.Start([]string{"-u", pdAddr, "--cacert=ca.pem", "cluster"})
temp.Close()
os.Stdout = old
out, _ := ioutil.ReadFile(fname)
c.Assert(strings.Contains(string(out), "no such file or directory"), IsTrue)

// cluster status
args = []string{"-u", pdAddr, "cluster", "status"}
_, output, err = pdctl.ExecuteCommandC(cmd, args...)
Expand Down
1 change: 1 addition & 0 deletions tools/pd-ctl/pdctl/ctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func Start(args []string) {

rootCmd.SetArgs(args)
rootCmd.SilenceErrors = true
rootCmd.ParseFlags(args)
rootCmd.SetUsageTemplate(command.UsageTemplate)
rootCmd.SetOutput(os.Stdout)

Expand Down

0 comments on commit 98bf47e

Please sign in to comment.