summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorAlexander Neumann <alexander@bumpern.de>2015-11-08 22:41:45 +0100
committerAlexander Neumann <alexander@bumpern.de>2015-11-08 22:41:45 +0100
commit1f9aea9905307c4f082e1e7528ed40fd0e943038 (patch)
tree16e4ab4ff71509077851f0ea08b1002d0969db5e /cmd
parent742d69bf4d3913d459fe02ecd0adefbfaf4dd15c (diff)
fix test on windows, reset read-only flag
Diffstat (limited to 'cmd')
-rw-r--r--cmd/restic/integration_helpers_test.go10
-rw-r--r--cmd/restic/integration_test.go2
2 files changed, 11 insertions, 1 deletions
diff --git a/cmd/restic/integration_helpers_test.go b/cmd/restic/integration_helpers_test.go
index 857096c58..734d974c1 100644
--- a/cmd/restic/integration_helpers_test.go
+++ b/cmd/restic/integration_helpers_test.go
@@ -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)
+}
diff --git a/cmd/restic/integration_test.go b/cmd/restic/integration_test.go
index baf12fe02..263f6cd16 100644
--- a/cmd/restic/integration_test.go
+++ b/cmd/restic/integration_test.go
@@ -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)