2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-22 10:58:55 +00:00

test: use parameter instead of hardcoded constant

This commit is contained in:
Michael Eischer 2023-05-18 19:31:42 +02:00
parent a719d10e22
commit 0058745881
3 changed files with 3 additions and 3 deletions

View File

@ -419,7 +419,7 @@ type blobCountingRepo struct {
} }
func (repo *blobCountingRepo) SaveBlob(ctx context.Context, t restic.BlobType, buf []byte, id restic.ID, storeDuplicate bool) (restic.ID, bool, int, error) { func (repo *blobCountingRepo) SaveBlob(ctx context.Context, t restic.BlobType, buf []byte, id restic.ID, storeDuplicate bool) (restic.ID, bool, int, error) {
id, exists, size, err := repo.Repository.SaveBlob(ctx, t, buf, id, false) id, exists, size, err := repo.Repository.SaveBlob(ctx, t, buf, id, storeDuplicate)
if exists { if exists {
return id, exists, size, err return id, exists, size, err
} }

View File

@ -18,7 +18,7 @@ import (
func createTestFiles(t testing.TB, num int) (files []string) { func createTestFiles(t testing.TB, num int) (files []string) {
tempdir := test.TempDir(t) tempdir := test.TempDir(t)
for i := 0; i < 15; i++ { for i := 0; i < num; i++ {
filename := fmt.Sprintf("testfile-%d", i) filename := fmt.Sprintf("testfile-%d", i)
err := os.WriteFile(filepath.Join(tempdir, filename), []byte(filename), 0600) err := os.WriteFile(filepath.Join(tempdir, filename), []byte(filename), 0600)
if err != nil { if err != nil {

View File

@ -331,7 +331,7 @@ var (
func createFilledRepo(t testing.TB, snapshots int, dup float32, version uint) restic.Repository { func createFilledRepo(t testing.TB, snapshots int, dup float32, version uint) restic.Repository {
repo := repository.TestRepositoryWithVersion(t, version) repo := repository.TestRepositoryWithVersion(t, version)
for i := 0; i < 3; i++ { for i := 0; i < snapshots; i++ {
restic.TestCreateSnapshot(t, repo, snapshotTime.Add(time.Duration(i)*time.Second), depth, dup) restic.TestCreateSnapshot(t, repo, snapshotTime.Add(time.Duration(i)*time.Second), depth, dup)
} }
return repo return repo