mirror of
https://github.com/octoleo/restic.git
synced 2024-11-29 16:23:59 +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.
|
// Close terminates the backend.
|
||||||
func (be *Backend) Close() error {
|
func (be *Backend) Close() error {
|
||||||
debug.Log("exting rclone")
|
debug.Log("exiting rclone")
|
||||||
be.tr.CloseIdleConnections()
|
be.tr.CloseIdleConnections()
|
||||||
<-be.waitCh
|
<-be.waitCh
|
||||||
debug.Log("wait for rclone returned: %v", be.waitResult)
|
debug.Log("wait for rclone returned: %v", be.waitResult)
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
package rclone_test
|
package rclone_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/restic/restic/internal/backend/rclone"
|
"github.com/restic/restic/internal/backend/rclone"
|
||||||
@ -15,35 +11,15 @@ import (
|
|||||||
rtest "github.com/restic/restic/internal/test"
|
rtest "github.com/restic/restic/internal/test"
|
||||||
)
|
)
|
||||||
|
|
||||||
const rcloneConfig = `
|
|
||||||
[local]
|
|
||||||
type = local
|
|
||||||
`
|
|
||||||
|
|
||||||
func newTestSuite(t testing.TB) *test.Suite {
|
func newTestSuite(t testing.TB) *test.Suite {
|
||||||
dir, cleanup := rtest.TempDir(t)
|
dir, cleanup := rtest.TempDir(t)
|
||||||
|
|
||||||
return &test.Suite{
|
return &test.Suite{
|
||||||
// NewConfig returns a config for a new temporary backend that will be used in tests.
|
// NewConfig returns a config for a new temporary backend that will be used in tests.
|
||||||
NewConfig: func() (interface{}, error) {
|
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)
|
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 := rclone.NewConfig()
|
||||||
cfg.Program = fmt.Sprintf("rclone --config %q", cfgfile)
|
cfg.Remote = dir
|
||||||
cfg.Remote = "local:" + repodir
|
|
||||||
return cfg, nil
|
return cfg, nil
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
// Config contains all configuration necessary to start rclone.
|
// Config contains all configuration necessary to start rclone.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Program string `option:"program" help:"path to rclone (default: rclone)"`
|
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
|
Remote string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user