From 35992917b5c857f16dd7e294b6b9b30c0fedeef7 Mon Sep 17 00:00:00 2001 From: Chapuis Bertil Date: Wed, 16 Sep 2015 10:45:25 +0200 Subject: [PATCH] directory initialization in rest tests --- backend/rest_test.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/backend/rest_test.go b/backend/rest_test.go index 14232ae09..2098d518e 100644 --- a/backend/rest_test.go +++ b/backend/rest_test.go @@ -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()