1
0
Fork 0
mirror of https://github.com/restic/restic.git synced 2025-03-16 00:00:05 +01:00

directory initialization in rest tests

This commit is contained in:
Chapuis Bertil 2015-09-16 10:45:25 +02:00
parent e8ec7d101b
commit 35992917b5

View file

@ -18,19 +18,20 @@ import (
func TestRestBackend(t *testing.T) {
// Initializing a temporary direcory for the rest backend.
// Initialize a temporary direcory for the rest backend.
path, _ := ioutil.TempDir("", "restic-repository-")
defer os.RemoveAll(path)
// Create all the necessary subdirectories
dirs := []string{
path,
filepath.Join(path, string(backend.Paths.Data)),
filepath.Join(path, string(backend.Paths.Snapshots)),
filepath.Join(path, string(backend.Paths.Index)),
filepath.Join(path, string(backend.Paths.Locks)),
filepath.Join(path, string(backend.Paths.Keys)),
backend.Paths.Data,
backend.Paths.Snapshots,
backend.Paths.Index,
backend.Paths.Locks,
backend.Paths.Keys,
}
for _, d := range dirs {
os.MkdirAll(d, backend.Modes.Dir)
os.MkdirAll(filepath.Join(path, d), backend.Modes.Dir)
}
r := mux.NewRouter()