mirror of
https://github.com/octoleo/restic.git
synced 2024-11-27 07:16:40 +00:00
restorer: add test for file truncation case
This commit is contained in:
parent
6f8e17a463
commit
10efa77103
@ -1003,6 +1003,7 @@ func TestRestorerOverwriteBehavior(t *testing.T) {
|
|||||||
"dirtest": Dir{
|
"dirtest": Dir{
|
||||||
Nodes: map[string]Node{
|
Nodes: map[string]Node{
|
||||||
"file": File{Data: "content: file\n", ModTime: baseTime},
|
"file": File{Data: "content: file\n", ModTime: baseTime},
|
||||||
|
"foo": File{Data: "content: foobar", ModTime: baseTime},
|
||||||
},
|
},
|
||||||
ModTime: baseTime,
|
ModTime: baseTime,
|
||||||
},
|
},
|
||||||
@ -1014,6 +1015,7 @@ func TestRestorerOverwriteBehavior(t *testing.T) {
|
|||||||
"dirtest": Dir{
|
"dirtest": Dir{
|
||||||
Nodes: map[string]Node{
|
Nodes: map[string]Node{
|
||||||
"file": File{Data: "content: file2\n", ModTime: baseTime.Add(-time.Second)},
|
"file": File{Data: "content: file2\n", ModTime: baseTime.Add(-time.Second)},
|
||||||
|
"foo": File{Data: "content: foo", ModTime: baseTime},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -1029,13 +1031,14 @@ func TestRestorerOverwriteBehavior(t *testing.T) {
|
|||||||
Files: map[string]string{
|
Files: map[string]string{
|
||||||
"foo": "content: new\n",
|
"foo": "content: new\n",
|
||||||
"dirtest/file": "content: file2\n",
|
"dirtest/file": "content: file2\n",
|
||||||
|
"dirtest/foo": "content: foo",
|
||||||
},
|
},
|
||||||
Progress: restoreui.State{
|
Progress: restoreui.State{
|
||||||
FilesFinished: 3,
|
FilesFinished: 4,
|
||||||
FilesTotal: 3,
|
FilesTotal: 4,
|
||||||
FilesSkipped: 0,
|
FilesSkipped: 0,
|
||||||
AllBytesWritten: 28,
|
AllBytesWritten: 40,
|
||||||
AllBytesTotal: 28,
|
AllBytesTotal: 40,
|
||||||
AllBytesSkipped: 0,
|
AllBytesSkipped: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -1044,13 +1047,14 @@ func TestRestorerOverwriteBehavior(t *testing.T) {
|
|||||||
Files: map[string]string{
|
Files: map[string]string{
|
||||||
"foo": "content: new\n",
|
"foo": "content: new\n",
|
||||||
"dirtest/file": "content: file2\n",
|
"dirtest/file": "content: file2\n",
|
||||||
|
"dirtest/foo": "content: foo",
|
||||||
},
|
},
|
||||||
Progress: restoreui.State{
|
Progress: restoreui.State{
|
||||||
FilesFinished: 3,
|
FilesFinished: 4,
|
||||||
FilesTotal: 3,
|
FilesTotal: 4,
|
||||||
FilesSkipped: 0,
|
FilesSkipped: 0,
|
||||||
AllBytesWritten: 28,
|
AllBytesWritten: 40,
|
||||||
AllBytesTotal: 28,
|
AllBytesTotal: 40,
|
||||||
AllBytesSkipped: 0,
|
AllBytesSkipped: 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -1059,14 +1063,15 @@ func TestRestorerOverwriteBehavior(t *testing.T) {
|
|||||||
Files: map[string]string{
|
Files: map[string]string{
|
||||||
"foo": "content: new\n",
|
"foo": "content: new\n",
|
||||||
"dirtest/file": "content: file\n",
|
"dirtest/file": "content: file\n",
|
||||||
|
"dirtest/foo": "content: foobar",
|
||||||
},
|
},
|
||||||
Progress: restoreui.State{
|
Progress: restoreui.State{
|
||||||
FilesFinished: 2,
|
FilesFinished: 2,
|
||||||
FilesTotal: 2,
|
FilesTotal: 2,
|
||||||
FilesSkipped: 1,
|
FilesSkipped: 2,
|
||||||
AllBytesWritten: 13,
|
AllBytesWritten: 13,
|
||||||
AllBytesTotal: 13,
|
AllBytesTotal: 13,
|
||||||
AllBytesSkipped: 15,
|
AllBytesSkipped: 27,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1074,14 +1079,15 @@ func TestRestorerOverwriteBehavior(t *testing.T) {
|
|||||||
Files: map[string]string{
|
Files: map[string]string{
|
||||||
"foo": "content: foo\n",
|
"foo": "content: foo\n",
|
||||||
"dirtest/file": "content: file\n",
|
"dirtest/file": "content: file\n",
|
||||||
|
"dirtest/foo": "content: foobar",
|
||||||
},
|
},
|
||||||
Progress: restoreui.State{
|
Progress: restoreui.State{
|
||||||
FilesFinished: 1,
|
FilesFinished: 1,
|
||||||
FilesTotal: 1,
|
FilesTotal: 1,
|
||||||
FilesSkipped: 2,
|
FilesSkipped: 3,
|
||||||
AllBytesWritten: 0,
|
AllBytesWritten: 0,
|
||||||
AllBytesTotal: 0,
|
AllBytesTotal: 0,
|
||||||
AllBytesSkipped: 28,
|
AllBytesSkipped: 40,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user