forked from TrueCloudLab/restic
Allow configuring temp dir for tests
This commit is contained in:
parent
a59b0ec1f6
commit
ef498a987b
2 changed files with 3 additions and 2 deletions
|
@ -16,9 +16,10 @@ import (
|
||||||
var testPassword = "foobar"
|
var testPassword = "foobar"
|
||||||
var testCleanup = flag.Bool("test.cleanup", true, "clean up after running tests (remove local backend directory with all content)")
|
var testCleanup = flag.Bool("test.cleanup", true, "clean up after running tests (remove local backend directory with all content)")
|
||||||
var testLargeCrypto = flag.Bool("test.largecrypto", false, "also test crypto functions with large payloads")
|
var testLargeCrypto = flag.Bool("test.largecrypto", false, "also test crypto functions with large payloads")
|
||||||
|
var testTempDir = flag.String("test.tempdir", "", "use this directory for temporary storage (default: system temp dir)")
|
||||||
|
|
||||||
func setupBackend(t testing.TB) restic.Server {
|
func setupBackend(t testing.TB) restic.Server {
|
||||||
tempdir, err := ioutil.TempDir("", "restic-test-")
|
tempdir, err := ioutil.TempDir(*testTempDir, "restic-test-")
|
||||||
ok(t, err)
|
ok(t, err)
|
||||||
|
|
||||||
b, err := backend.CreateLocal(tempdir)
|
b, err := backend.CreateLocal(tempdir)
|
||||||
|
|
|
@ -21,7 +21,7 @@ var testFiles = []struct {
|
||||||
|
|
||||||
// prepareDir creates a temporary directory and returns it.
|
// prepareDir creates a temporary directory and returns it.
|
||||||
func prepareDir(t *testing.T) string {
|
func prepareDir(t *testing.T) string {
|
||||||
tempdir, err := ioutil.TempDir("", "restic-test-")
|
tempdir, err := ioutil.TempDir(*testTempDir, "restic-test-")
|
||||||
ok(t, err)
|
ok(t, err)
|
||||||
|
|
||||||
for _, test := range testFiles {
|
for _, test := range testFiles {
|
||||||
|
|
Loading…
Reference in a new issue