mirror of
https://github.com/octoleo/restic.git
synced 2024-11-26 06:46:34 +00:00
Add test for not-existing top-level dir and top-level file
This commit is contained in:
parent
df64998649
commit
9acc9243ba
@ -202,6 +202,16 @@ func TestRestorer(t *testing.T) {
|
||||
"dir/file": "file in dir",
|
||||
},
|
||||
},
|
||||
{
|
||||
Snapshot: Snapshot{
|
||||
Nodes: map[string]Node{
|
||||
"topfile": File{"top-level file"},
|
||||
},
|
||||
},
|
||||
Files: map[string]string{
|
||||
"topfile": "top-level file",
|
||||
},
|
||||
},
|
||||
|
||||
// test cases with invalid/constructed names
|
||||
{
|
||||
@ -273,6 +283,9 @@ func TestRestorer(t *testing.T) {
|
||||
tempdir, cleanup := rtest.TempDir(t)
|
||||
defer cleanup()
|
||||
|
||||
// make sure we're creating a new subdir of the tempdir
|
||||
tempdir = filepath.Join(tempdir, "target")
|
||||
|
||||
res.SelectFilter = func(item, dstpath string, node *restic.Node) (selectedForRestore bool, childMayBeSelected bool) {
|
||||
t.Logf("restore %v to %v", item, dstpath)
|
||||
if !fs.HasPathPrefix(tempdir, dstpath) {
|
||||
|
Loading…
Reference in New Issue
Block a user