etcdctl/ctlv3: fix snapshot command e2e tests

Signed-off-by: Gyuho Lee <gyuhox@gmail.com>
This commit is contained in:
Gyuho Lee 2018-04-16 17:20:57 -07:00
parent b7ce6b7265
commit ae9ccd883d
3 changed files with 4 additions and 16 deletions

View File

@ -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{

View File

@ -239,6 +239,7 @@ func (s *v3Manager) Restore(cfg RestoreConfig) error {
}
srv := etcdserver.ServerConfig{
Logger: s.lg,
Name: cfg.Name,
PeerURLs: pURLs,
InitialPeerURLsMap: ics,

View File

@ -117,7 +117,6 @@ func snapshotStatusBeforeRestoreTest(cx ctlCtx) {
"--data-dir", "snap.etcd",
fpath),
"added member")
if serr != nil {
cx.t.Fatal(serr)
}