From fc0295016ab56bf6a1db9aa7e651cba27a7bdf37 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Thu, 15 Mar 2018 19:00:25 +0100 Subject: [PATCH] Address code review comments --- internal/backend/rclone/backend.go | 2 +- internal/backend/rclone/backend_test.go | 26 +------------------------ internal/backend/rclone/config.go | 2 +- 3 files changed, 3 insertions(+), 27 deletions(-) diff --git a/internal/backend/rclone/backend.go b/internal/backend/rclone/backend.go index c04eb5611..40f434b3e 100644 --- a/internal/backend/rclone/backend.go +++ b/internal/backend/rclone/backend.go @@ -231,7 +231,7 @@ func Create(cfg Config) (*Backend, error) { // Close terminates the backend. func (be *Backend) Close() error { - debug.Log("exting rclone") + debug.Log("exiting rclone") be.tr.CloseIdleConnections() <-be.waitCh debug.Log("wait for rclone returned: %v", be.waitResult) diff --git a/internal/backend/rclone/backend_test.go b/internal/backend/rclone/backend_test.go index 9f76b517c..16281035d 100644 --- a/internal/backend/rclone/backend_test.go +++ b/internal/backend/rclone/backend_test.go @@ -1,11 +1,7 @@ package rclone_test import ( - "fmt" - "io/ioutil" - "os" "os/exec" - "path/filepath" "testing" "github.com/restic/restic/internal/backend/rclone" @@ -15,35 +11,15 @@ import ( rtest "github.com/restic/restic/internal/test" ) -const rcloneConfig = ` -[local] -type = local -` - func newTestSuite(t testing.TB) *test.Suite { dir, cleanup := rtest.TempDir(t) return &test.Suite{ // NewConfig returns a config for a new temporary backend that will be used in tests. NewConfig: func() (interface{}, error) { - cfgfile := filepath.Join(dir, "rclone.conf") - t.Logf("write rclone config to %v", cfgfile) - err := ioutil.WriteFile(cfgfile, []byte(rcloneConfig), 0644) - if err != nil { - return nil, err - } - t.Logf("use backend at %v", dir) - - repodir := filepath.Join(dir, "repo") - err = os.Mkdir(repodir, 0755) - if err != nil { - return nil, err - } - cfg := rclone.NewConfig() - cfg.Program = fmt.Sprintf("rclone --config %q", cfgfile) - cfg.Remote = "local:" + repodir + cfg.Remote = dir return cfg, nil }, diff --git a/internal/backend/rclone/config.go b/internal/backend/rclone/config.go index a833d153b..fa4ce88df 100644 --- a/internal/backend/rclone/config.go +++ b/internal/backend/rclone/config.go @@ -10,7 +10,7 @@ import ( // Config contains all configuration necessary to start rclone. type Config struct { Program string `option:"program" help:"path to rclone (default: rclone)"` - Args string `option:"args" help:"arguments for running rclone (default: restic serve --stdio)"` + Args string `option:"args" help:"arguments for running rclone (default: serve restic --stdio)"` Remote string }