mirror of
https://github.com/restic/restic.git
synced 2025-03-09 00:00:02 +01:00
local: Add layout tests
This commit is contained in:
parent
24ebf95f33
commit
e3e3a8a695
1 changed files with 43 additions and 0 deletions
43
src/restic/backend/local/local_layout_test.go
Normal file
43
src/restic/backend/local/local_layout_test.go
Normal file
|
@ -0,0 +1,43 @@
|
|||
package local
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
. "restic/test"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestLocalLayout(t *testing.T) {
|
||||
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"))
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue