Add checker and command 'check' to replace 'fsck'

This commit is contained in:
Alexander Neumann
2015-06-29 00:22:25 +02:00
parent cbcf58f1c0
commit 54c4c29a89
7 changed files with 256 additions and 311 deletions

33
checker/checker_test.go Normal file
View File

@@ -0,0 +1,33 @@
package checker_test
import (
"path/filepath"
"testing"
"github.com/restic/restic/backend"
"github.com/restic/restic/checker"
"github.com/restic/restic/repository"
. "github.com/restic/restic/test"
)
var checkerTestData = filepath.Join("testdata", "checker-test-repo.tar.gz")
func list(repo *repository.Repository, t backend.Type) (IDs []string) {
done := make(chan struct{})
defer close(done)
for id := range repo.List(t, done) {
IDs = append(IDs, id.String())
}
return IDs
}
func TestCheckRepo(t *testing.T) {
WithTestEnvironment(t, checkerTestData, func(repodir string) {
repo := OpenLocalRepo(t, repodir)
checker := checker.New(repo)
OK(t, checker.LoadIndex())
})
}