mirror of
https://github.com/restic/restic.git
synced 2025-12-12 15:03:05 +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) {
|
func TestArchiverErrorReporting(t *testing.T) {
|
||||||
ignoreErrorForBasename := func(basename string) ErrorFunc {
|
ignoreErrorForBasename := func(basename string) ErrorFunc {
|
||||||
return func(item string, err error) error {
|
return func(item string, err error) error {
|
||||||
if filepath.Base(item) == "targetfile" {
|
if filepath.Base(item) == basename {
|
||||||
t.Logf("ignoring error for targetfile: %v", err)
|
t.Logf("ignoring error for %v: %v", basename, err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1936,6 +1936,14 @@ func TestArchiverErrorReporting(t *testing.T) {
|
|||||||
src: TestDir{},
|
src: TestDir{},
|
||||||
errStr: "stat subdir: no such file or directory",
|
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 {
|
for _, test := range tests {
|
||||||
|
|||||||
Reference in New Issue
Block a user