diff --git a/cmd/restic/integration_test.go b/cmd/restic/integration_test.go index e602b9113..0a77517e4 100644 --- a/cmd/restic/integration_test.go +++ b/cmd/restic/integration_test.go @@ -2,7 +2,6 @@ package main import ( "bufio" - "flag" "io" "io/ioutil" "os" @@ -14,8 +13,6 @@ import ( . "github.com/restic/restic/test" ) -var TestDataFile = flag.String("test.datafile", "", `specify tar.gz file with test data to backup and restore (required for integration test)`) - func setupTempdir(t testing.TB) (tempdir string) { tempdir, err := ioutil.TempDir(TestTempDir, "restic-test-") OK(t, err) @@ -120,9 +117,14 @@ func TestBackup(t *testing.T) { t.Skip("integration tests disabled, use `-test.integration` to enable") } - if *TestDataFile == "" { - t.Fatal("no data tar file specified, use flag `-test.datafile`") + datafile := filepath.Join("testdata", "backup-data.tar.gz") + fd, err := os.Open(datafile) + if os.IsNotExist(err) { + t.Skipf("unable to find data file %q, skipping TestBackup", datafile) + return } + OK(t, err) + OK(t, fd.Close()) tempdir := setupTempdir(t) defer cleanupTempdir(t, tempdir) @@ -133,7 +135,7 @@ func TestBackup(t *testing.T) { datadir := filepath.Join(tempdir, "testdata") - setupTarTestFixture(t, datadir, *TestDataFile) + setupTarTestFixture(t, datadir, datafile) // first backup cmdBackup(t, []string{datadir}, nil) diff --git a/cmd/restic/testdata/backup-data.tar.gz b/cmd/restic/testdata/backup-data.tar.gz new file mode 100644 index 000000000..337c18fd9 Binary files /dev/null and b/cmd/restic/testdata/backup-data.tar.gz differ