Skip to content

Commit

Permalink
etcdctl/ctlv3: fix snapshot command e2e tests
Browse files Browse the repository at this point in the history
Signed-off-by: Gyuho Lee <[email protected]>
  • Loading branch information
gyuho committed Apr 17, 2018
1 parent ae9afe0 commit 6c77c30
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
18 changes: 3 additions & 15 deletions etcdctl/ctlv3/command/snapshot_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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 {
Expand All @@ -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{
Expand Down
1 change: 1 addition & 0 deletions snapshot/v3_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ func (s *v3Manager) Restore(cfg RestoreConfig) error {
}

srv := etcdserver.ServerConfig{
Logger: s.lg,
Name: cfg.Name,
PeerURLs: pURLs,
InitialPeerURLsMap: ics,
Expand Down
1 change: 0 additions & 1 deletion tests/e2e/ctl_v3_snapshot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ func snapshotStatusBeforeRestoreTest(cx ctlCtx) {
"--data-dir", "snap.etcd",
fpath),
"added member")

if serr != nil {
cx.t.Fatal(serr)
}
Expand Down

0 comments on commit 6c77c30

Please sign in to comment.