Rename variables

This commit is contained in:
Alexander Neumann 2015-05-09 13:32:52 +02:00
parent 7ec674f3e8
commit d9b5832034
18 changed files with 144 additions and 144 deletions

View file

@ -17,7 +17,7 @@ var TestPassword = flag.String("test.password", "", `use this password for repos
var TestCleanup = flag.Bool("test.cleanup", true, "clean up after running tests (remove local backend directory with all content)")
var TestTempDir = flag.String("test.tempdir", "", "use this directory for temporary storage (default: system temp dir)")
func SetupBackend(t testing.TB) *repo.Repository {
func SetupRepo(t testing.TB) *repo.Repository {
tempdir, err := ioutil.TempDir(*TestTempDir, "restic-test-")
OK(t, err)
@ -29,23 +29,23 @@ func SetupBackend(t testing.TB) *repo.Repository {
err = os.Setenv("RESTIC_CACHE", filepath.Join(tempdir, "cache"))
OK(t, err)
s := repo.New(b)
OK(t, s.Init(*TestPassword))
return s
repo := repo.New(b)
OK(t, repo.Init(*TestPassword))
return repo
}
func TeardownBackend(t testing.TB, s *repo.Repository) {
func TeardownRepo(t testing.TB, repo *repo.Repository) {
if !*TestCleanup {
l := s.Backend().(*local.Local)
l := repo.Backend().(*local.Local)
t.Logf("leaving local backend at %s\n", l.Location())
return
}
OK(t, s.Delete())
OK(t, repo.Delete())
}
func SnapshotDir(t testing.TB, server *repo.Repository, path string, parent backend.ID) *restic.Snapshot {
arch := restic.NewArchiver(server)
func SnapshotDir(t testing.TB, repo *repo.Repository, path string, parent backend.ID) *restic.Snapshot {
arch := restic.NewArchiver(repo)
sn, _, err := arch.Snapshot(nil, []string{path}, parent)
OK(t, err)
return sn