1
0
mirror of https://github.com/restic/restic.git synced 2024-07-06 09:20:53 +02:00
restic/src/restic/backend/local/layout_test.go

44 lines
826 B
Go
Raw Normal View History

2017-04-02 19:56:33 +02:00
package local
import (
"path/filepath"
. "restic/test"
"testing"
)
2017-04-10 22:34:39 +02:00
func TestLayout(t *testing.T) {
2017-04-02 19:56:33 +02:00
path, cleanup := TempDir(t)
defer cleanup()
var tests = []struct {
filename string
layout string
failureExpected bool
}{
{"repo-layout-local.tar.gz", "", false},
{"repo-layout-cloud.tar.gz", "", false},
{"repo-layout-s3-old.tar.gz", "", false},
}
for _, test := range tests {
t.Run(test.filename, func(t *testing.T) {
SetupTarTestFixture(t, path, filepath.Join("..", "testdata", test.filename))
repo := filepath.Join(path, "repo")
be, err := Open(Config{
Path: repo,
Layout: test.layout,
})
if err != nil {
t.Fatal(err)
}
if be == nil {
t.Fatalf("Open() returned nil but no error")
}
RemoveAll(t, filepath.Join(path, "repo"))
})
}
}