mirror of
https://github.com/restic/restic.git
synced 2025-10-19 15:43:21 +00:00
backup: test that parent directory errors can be correctly filtered
This commit is contained in:
parent
d57b01d6eb
commit
b67b88a0c0
1 changed files with 10 additions and 2 deletions
|
@ -1846,8 +1846,8 @@ func TestArchiverParent(t *testing.T) {
|
|||
func TestArchiverErrorReporting(t *testing.T) {
|
||||
ignoreErrorForBasename := func(basename string) ErrorFunc {
|
||||
return func(item string, err error) error {
|
||||
if filepath.Base(item) == "targetfile" {
|
||||
t.Logf("ignoring error for targetfile: %v", err)
|
||||
if filepath.Base(item) == basename {
|
||||
t.Logf("ignoring error for %v: %v", basename, err)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -1936,6 +1936,14 @@ func TestArchiverErrorReporting(t *testing.T) {
|
|||
src: TestDir{},
|
||||
errStr: "stat subdir: no such file or directory",
|
||||
},
|
||||
{
|
||||
name: "parent-dir-missing-filtered",
|
||||
targets: []string{"targetfile", "subdir/missing"},
|
||||
src: TestDir{
|
||||
"targetfile": TestFile{Content: "foobar"},
|
||||
},
|
||||
errFn: ignoreErrorForBasename("subdir"),
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue