2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-22 10:58:55 +00:00

Add test case for #1512

This commit is contained in:
Alexander Neumann 2018-01-07 14:50:47 +01:00
parent e120b17abd
commit aab414b368

View File

@ -29,6 +29,7 @@ type File struct {
type Dir struct {
Nodes map[string]Node
Mode os.FileMode
}
func saveFile(t testing.TB, repo restic.Repository, node File) restic.ID {
@ -63,9 +64,15 @@ func saveDir(t testing.TB, repo restic.Repository, nodes map[string]Node) restic
})
case Dir:
id = saveDir(t, repo, node.Nodes)
mode := node.Mode
if mode == 0 {
mode = 0755
}
tree.Insert(&restic.Node{
Type: "dir",
Mode: 0755,
Mode: mode,
Name: name,
UID: uint32(os.Getuid()),
GID: uint32(os.Getgid()),
@ -166,6 +173,21 @@ func TestRestorer(t *testing.T) {
"dir/subdir/file": "file in subdir",
},
},
{
Snapshot: Snapshot{
Nodes: map[string]Node{
"dir": Dir{
Mode: 0444,
Nodes: map[string]Node{
"file": File{"file in dir"},
},
},
},
},
Files: map[string]string{
"dir/file": "file in dir",
},
},
// test cases with invalid/constructed names
{