mirror of
https://github.com/restic/restic.git
synced 2026-11-22 13:24:24 +00:00
repository/checker: speed up test repo creation
data.TestCreateSnapshot is much faster than archiver.TestSnapshot
This commit is contained in:
1 parent
37e8f50aeb
commit
2148508050
2 files changed
+4
-4
No files matched your search
@@ -12,7 +12,6 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/restic/restic/internal/archiver"
|
|
||||||
"github.com/restic/restic/internal/backend"
|
"github.com/restic/restic/internal/backend"
|
||||||
"github.com/restic/restic/internal/checker"
|
"github.com/restic/restic/internal/checker"
|
||||||
"github.com/restic/restic/internal/data"
|
"github.com/restic/restic/internal/data"
|
||||||
@@ -310,7 +309,7 @@ func (b *errorOnceBackend) Load(ctx context.Context, h backend.Handle, length in
|
|||||||
|
|
||||||
func TestCheckerModifiedData(t *testing.T) {
|
func TestCheckerModifiedData(t *testing.T) {
|
||||||
repo, _, be := repository.TestRepositoryWithVersion(t, 0)
|
repo, _, be := repository.TestRepositoryWithVersion(t, 0)
|
||||||
sn := archiver.TestSnapshot(t, repo, ".", nil)
|
sn := data.TestCreateSnapshot(t, repo, time.Unix(1470492820, 207401672), 2)
|
||||||
t.Logf("archived as %v", sn.ID().Str())
|
t.Logf("archived as %v", sn.ID().Str())
|
||||||
|
|
||||||
errBe := &errorBackend{Backend: be}
|
errBe := &errorBackend{Backend: be}
|
||||||
|
|||||||
@@ -8,10 +8,11 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/klauspost/compress/zstd"
|
"github.com/klauspost/compress/zstd"
|
||||||
"github.com/restic/restic/internal/archiver"
|
|
||||||
"github.com/restic/restic/internal/backend"
|
"github.com/restic/restic/internal/backend"
|
||||||
|
"github.com/restic/restic/internal/data"
|
||||||
"github.com/restic/restic/internal/errors"
|
"github.com/restic/restic/internal/errors"
|
||||||
"github.com/restic/restic/internal/repository/pack"
|
"github.com/restic/restic/internal/repository/pack"
|
||||||
"github.com/restic/restic/internal/restic"
|
"github.com/restic/restic/internal/restic"
|
||||||
@@ -153,7 +154,7 @@ func setupChecker(t *testing.T, wrap func(backend.Backend) backend.Backend) *Che
|
|||||||
t.Helper()
|
t.Helper()
|
||||||
// Write a snapshot into a fresh in-memory repository.
|
// Write a snapshot into a fresh in-memory repository.
|
||||||
repo, be := TestRepositoryWithBackend(t, nil, 0, Options{})
|
repo, be := TestRepositoryWithBackend(t, nil, 0, Options{})
|
||||||
_ = archiver.TestSnapshot(t, repo, ".", nil)
|
data.TestCreateSnapshot(t, repo, time.Unix(1470492820, 207401672), 2)
|
||||||
|
|
||||||
// Re-open the same backend (now containing real pack files) through
|
// Re-open the same backend (now containing real pack files) through
|
||||||
// the corruption wrapper so the checker reads corrupted data.
|
// the corruption wrapper so the checker reads corrupted data.
|
||||||
|
|||||||
Reference in new issue
Block a user