mirror of
https://github.com/restic/restic.git
synced 2025-12-24 11:26:27 +00:00
Add checker and command 'check' to replace 'fsck'
This commit is contained in:
33
checker/checker_test.go
Normal file
33
checker/checker_test.go
Normal 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())
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user