mirror of
https://github.com/restic/restic.git
synced 2026-10-12 21:17:12 +00:00
data: fix invalid trees used in test cases
data.TestCreateSnapshot which is used in particular by TestFindUsedBlobs and TestFindUsedBlobs could generate trees with duplicate file names. This is invalid and going forward will result in an error.
This commit is contained in:
1 parent
34fdf5ba96
commit
d82ea53735
7 files changed
+24
-20
No files matched your search
@@ -81,7 +81,7 @@ func (fs *fakeFileSystem) saveTree(ctx context.Context, uploader restic.BlobSave
|
||||
id := fs.saveTree(ctx, uploader, treeSeed, depth-1)
|
||||
|
||||
node := &Node{
|
||||
Name: fmt.Sprintf("dir-%v", treeSeed),
|
||||
Name: fmt.Sprintf("dir-%v", i),
|
||||
Type: NodeTypeDir,
|
||||
Mode: 0755,
|
||||
Subtree: &id,
|
||||
@@ -95,7 +95,7 @@ func (fs *fakeFileSystem) saveTree(ctx context.Context, uploader restic.BlobSave
|
||||
fileSize := (maxFileSize / maxSeed) * fileSeed
|
||||
|
||||
node := &Node{
|
||||
Name: fmt.Sprintf("file-%v", fileSeed),
|
||||
Name: fmt.Sprintf("file-%v", i),
|
||||
Type: NodeTypeFile,
|
||||
Mode: 0644,
|
||||
Size: uint64(fileSize),
|
||||
@@ -106,7 +106,6 @@ func (fs *fakeFileSystem) saveTree(ctx context.Context, uploader restic.BlobSave
|
||||
}
|
||||
|
||||
tree.Sort()
|
||||
|
||||
id, err := SaveTree(ctx, uploader, &tree)
|
||||
if err != nil {
|
||||
fs.t.Fatalf("SaveTree returned error: %v", err)
|
||||
|
||||
Reference in new issue
Block a user