restic/cmd/restic/local_layout_test.go

41 lines
943 B
Go
Raw Normal View History

2017-04-02 18:33:24 +00:00
package main
import (
"path/filepath"
"testing"
2017-07-23 12:21:03 +00:00
. "github.com/restic/restic/internal/test"
2017-04-02 18:33:24 +00:00
)
func TestRestoreLocalLayout(t *testing.T) {
withTestEnvironment(t, func(env *testEnvironment, gopts GlobalOptions) {
var tests = []struct {
filename string
layout string
}{
2017-05-16 18:45:17 +00:00
{"repo-layout-default.tar.gz", ""},
{"repo-layout-s3legacy.tar.gz", ""},
{"repo-layout-default.tar.gz", "default"},
{"repo-layout-s3legacy.tar.gz", "s3legacy"},
2017-04-02 18:33:24 +00:00
}
for _, test := range tests {
2017-07-23 12:39:57 +00:00
datafile := filepath.Join("..", "..", "internal", "backend", "testdata", test.filename)
2017-04-02 18:33:24 +00:00
SetupTarTestFixture(t, env.base, datafile)
gopts.extended["local.layout"] = test.layout
// check the repo
testRunCheck(t, gopts)
// restore latest snapshot
target := filepath.Join(env.base, "restore")
testRunRestoreLatest(t, gopts, target, nil, "")
RemoveAll(t, filepath.Join(env.base, "repo"))
RemoveAll(t, target)
}
})
}