mirror of
https://github.com/restic/restic.git
synced 2025-12-11 18:47:50 +00:00
backup: test that parent directory errors can be correctly filtered
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user