diff --git a/src/cmds/restic/integration_test.go b/src/cmds/restic/integration_test.go index a3734bd02..426367724 100644 --- a/src/cmds/restic/integration_test.go +++ b/src/cmds/restic/integration_test.go @@ -7,6 +7,7 @@ import ( "fmt" "io" "io/ioutil" + mrand "math/rand" "os" "path/filepath" "regexp" @@ -739,6 +740,30 @@ func TestRestoreFilter(t *testing.T) { }) } +func TestRestore(t *testing.T) { + withTestEnvironment(t, func(env *testEnvironment, gopts GlobalOptions) { + testRunInit(t, gopts) + + for i := 0; i < 10; i++ { + p := filepath.Join(env.testdata, fmt.Sprintf("foo/bar/testfile%v", i)) + OK(t, os.MkdirAll(filepath.Dir(p), 0755)) + OK(t, appendRandomData(p, uint(mrand.Intn(5<<21)))) + } + + opts := BackupOptions{} + + testRunBackup(t, []string{env.testdata}, opts, gopts) + testRunCheck(t, gopts) + + // Restore latest without any filters + restoredir := filepath.Join(env.base, "restore") + testRunRestoreLatest(t, gopts, restoredir, nil, "") + + Assert(t, directoriesEqualContents(env.testdata, filepath.Join(restoredir, filepath.Base(env.testdata))), + "directories are not equal") + }) +} + func TestRestoreLatest(t *testing.T) { withTestEnvironment(t, func(env *testEnvironment, gopts GlobalOptions) {