mirror of
https://github.com/octoleo/restic.git
synced 2024-11-11 07:41:03 +00:00
repository: use normal Init method in tests
This commit is contained in:
parent
b25fc2c89d
commit
7d1b9cde34
@ -60,8 +60,11 @@ func TestRepositoryWithBackend(t testing.TB, be backend.Backend, version uint, o
|
|||||||
t.Fatalf("TestRepository(): new repo failed: %v", err)
|
t.Fatalf("TestRepository(): new repo failed: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg := restic.TestCreateConfig(t, testChunkerPol, version)
|
if version == 0 {
|
||||||
err = repo.init(context.TODO(), test.TestPassword, cfg)
|
version = restic.StableRepoVersion
|
||||||
|
}
|
||||||
|
pol := testChunkerPol
|
||||||
|
err = repo.Init(context.TODO(), version, test.TestPassword, &pol)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("TestRepository(): initialize repo failed: %v", err)
|
t.Fatalf("TestRepository(): initialize repo failed: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -51,22 +51,6 @@ func CreateConfig(version uint) (Config, error) {
|
|||||||
return cfg, nil
|
return cfg, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestCreateConfig creates a config for use within tests.
|
|
||||||
func TestCreateConfig(t testing.TB, pol chunker.Pol, version uint) (cfg Config) {
|
|
||||||
cfg.ChunkerPolynomial = pol
|
|
||||||
|
|
||||||
cfg.ID = NewRandomID().String()
|
|
||||||
if version == 0 {
|
|
||||||
version = StableRepoVersion
|
|
||||||
}
|
|
||||||
if version < MinRepoVersion || version > MaxRepoVersion {
|
|
||||||
t.Fatalf("version %d is out of range", version)
|
|
||||||
}
|
|
||||||
cfg.Version = version
|
|
||||||
|
|
||||||
return cfg
|
|
||||||
}
|
|
||||||
|
|
||||||
var checkPolynomial = true
|
var checkPolynomial = true
|
||||||
var checkPolynomialOnce sync.Once
|
var checkPolynomialOnce sync.Once
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user