From 6c77c30b4ad72eaf1a881167a0435f3735425e4b Mon Sep 17 00:00:00 2001 From: Gyuho Lee Date: Mon, 16 Apr 2018 17:20:57 -0700 Subject: [PATCH] etcdctl/ctlv3: fix snapshot command e2e tests Signed-off-by: Gyuho Lee --- etcdctl/ctlv3/command/snapshot_command.go | 18 +++--------------- snapshot/v3_snapshot.go | 1 + tests/e2e/ctl_v3_snapshot_test.go | 1 - 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/etcdctl/ctlv3/command/snapshot_command.go b/etcdctl/ctlv3/command/snapshot_command.go index 22703feeffe4..045ae5645bc2 100644 --- a/etcdctl/ctlv3/command/snapshot_command.go +++ b/etcdctl/ctlv3/command/snapshot_command.go @@ -95,14 +95,10 @@ func snapshotSaveCommandFunc(cmd *cobra.Command, args []string) { ExitWithError(ExitBadArgs, err) } - debug, err := cmd.Flags().GetBool("debug") + lg, err := zap.NewProduction() if err != nil { ExitWithError(ExitError, err) } - lg := zap.NewNop() - if debug { - lg = zap.NewExample() - } sp := snapshot.NewV3(lg) cfg := mustClientCfgFromCmd(cmd) @@ -120,14 +116,10 @@ func snapshotStatusCommandFunc(cmd *cobra.Command, args []string) { } initDisplayFromCmd(cmd) - debug, err := cmd.Flags().GetBool("debug") + lg, err := zap.NewProduction() if err != nil { ExitWithError(ExitError, err) } - lg := zap.NewNop() - if debug { - lg = zap.NewExample() - } sp := snapshot.NewV3(lg) ds, err := sp.Status(args[0]) if err != nil { @@ -152,14 +144,10 @@ func snapshotRestoreCommandFunc(cmd *cobra.Command, args []string) { walDir = filepath.Join(dataDir, "member", "wal") } - debug, err := cmd.Flags().GetBool("debug") + lg, err := zap.NewProduction() if err != nil { ExitWithError(ExitError, err) } - lg := zap.NewNop() - if debug { - lg = zap.NewExample() - } sp := snapshot.NewV3(lg) if err := sp.Restore(snapshot.RestoreConfig{ diff --git a/snapshot/v3_snapshot.go b/snapshot/v3_snapshot.go index 6a3a504d6525..df8c3571643c 100644 --- a/snapshot/v3_snapshot.go +++ b/snapshot/v3_snapshot.go @@ -239,6 +239,7 @@ func (s *v3Manager) Restore(cfg RestoreConfig) error { } srv := etcdserver.ServerConfig{ + Logger: s.lg, Name: cfg.Name, PeerURLs: pURLs, InitialPeerURLsMap: ics, diff --git a/tests/e2e/ctl_v3_snapshot_test.go b/tests/e2e/ctl_v3_snapshot_test.go index 79e601239a27..f38b1cdbea0c 100644 --- a/tests/e2e/ctl_v3_snapshot_test.go +++ b/tests/e2e/ctl_v3_snapshot_test.go @@ -117,7 +117,6 @@ func snapshotStatusBeforeRestoreTest(cx ctlCtx) { "--data-dir", "snap.etcd", fpath), "added member") - if serr != nil { cx.t.Fatal(serr) }