restore: speed up test data generation in newTestRepo

This commit is contained in:
Michael Eischer
2026-06-14 21:40:50 +02:00
parent 1174e97b30
commit c183fe2035
+4 -3
View File
@@ -7,6 +7,7 @@ import (
"fmt"
"os"
"slices"
"strings"
"testing"
"github.com/restic/restic/internal/errors"
@@ -107,9 +108,9 @@ func newTestRepo(content []TestFile) *TestRepo {
filesPathToContent := make(map[string]string)
for _, file := range content {
var content string
content := strings.Builder{}
for _, blob := range file.blobs {
content += blob.data
content.WriteString(blob.data)
// get the pack, create as necessary
var pack Pack
@@ -134,7 +135,7 @@ func newTestRepo(content []TestFile) *TestRepo {
packs[blob.pack] = pack
}
filesPathToContent[file.name] = content
filesPathToContent[file.name] = content.String()
}
blobs := make(map[restic.ID][]restic.PackBlob)