mirror of https://github.com/restic/restic.git
Fix "cleanup" flag
This commit is contained in:
parent
d19b23d4f1
commit
edfd86624c
|
@ -99,7 +99,7 @@ func testBackend(b backend.Backend, t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove content if requested
|
// remove content if requested
|
||||||
if *testCleanup {
|
if *TestCleanup {
|
||||||
for _, test := range TestStrings {
|
for _, test := range TestStrings {
|
||||||
id, err := backend.ParseID(test.id)
|
id, err := backend.ParseID(test.id)
|
||||||
OK(t, err)
|
OK(t, err)
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package backend_test
|
package backend_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"flag"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -10,8 +9,6 @@ import (
|
||||||
. "github.com/restic/restic/test"
|
. "github.com/restic/restic/test"
|
||||||
)
|
)
|
||||||
|
|
||||||
var testCleanup = flag.Bool("test.cleanup", true, "clean up after running tests (remove local backend directory with all content)")
|
|
||||||
|
|
||||||
func setupLocalBackend(t *testing.T) *local.Local {
|
func setupLocalBackend(t *testing.T) *local.Local {
|
||||||
tempdir, err := ioutil.TempDir("", "restic-test-")
|
tempdir, err := ioutil.TempDir("", "restic-test-")
|
||||||
OK(t, err)
|
OK(t, err)
|
||||||
|
@ -25,7 +22,7 @@ func setupLocalBackend(t *testing.T) *local.Local {
|
||||||
}
|
}
|
||||||
|
|
||||||
func teardownLocalBackend(t *testing.T, b *local.Local) {
|
func teardownLocalBackend(t *testing.T, b *local.Local) {
|
||||||
if !*testCleanup {
|
if !*TestCleanup {
|
||||||
t.Logf("leaving local backend at %s\n", b.Location())
|
t.Logf("leaving local backend at %s\n", b.Location())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ func setupSFTPBackend(t *testing.T) *sftp.SFTP {
|
||||||
}
|
}
|
||||||
|
|
||||||
func teardownSFTPBackend(t *testing.T, b *sftp.SFTP) {
|
func teardownSFTPBackend(t *testing.T, b *sftp.SFTP) {
|
||||||
if !*testCleanup {
|
if !*TestCleanup {
|
||||||
t.Logf("leaving backend at %s\n", b.Location())
|
t.Logf("leaving backend at %s\n", b.Location())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue