forked from TrueCloudLab/restic
fix test on windows, reset read-only flag
This commit is contained in:
parent
742d69bf4d
commit
1f9aea9905
2 changed files with 11 additions and 1 deletions
|
@ -216,3 +216,13 @@ func withTestEnvironment(t testing.TB, f func(*testEnvironment, GlobalOptions))
|
|||
|
||||
RemoveAll(t, tempdir)
|
||||
}
|
||||
|
||||
// removeFile resets the read-only flag and then deletes the file.
|
||||
func removeFile(fn string) error {
|
||||
err := os.Chmod(fn, 0666)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return os.Remove(fn)
|
||||
}
|
||||
|
|
|
@ -726,7 +726,7 @@ func TestOptimizeRemoveUnusedBlobs(t *testing.T) {
|
|||
SetupTarTestFixture(t, env.base, test.testFilename)
|
||||
|
||||
for id := range test.snapshots {
|
||||
OK(t, os.Remove(filepath.Join(env.repo, "snapshots", id.String())))
|
||||
OK(t, removeFile(filepath.Join(env.repo, "snapshots", id.String())))
|
||||
}
|
||||
|
||||
cmdOptimize(t, global)
|
||||
|
|
Loading…
Reference in a new issue