mirror of
https://github.com/octoleo/restic.git
synced 2024-11-26 06:46:34 +00:00
Address code review comments
This commit is contained in:
parent
99b62c11b8
commit
fc0295016a
@ -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)
|
||||
|
@ -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
|
||||
},
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user