If the local file is empty, it should be fully restored
(t *testing.T)
| 383 | |
| 384 | // If the local file is empty, it should be fully restored |
| 385 | func TestRestoringPagesToEmptyFile(t *testing.T) { |
| 386 | pagedFile, _ := os.Open(pagedFileName) |
| 387 | fileReader := io.Reader(pagedFile) |
| 388 | defer utility.LoggedClose(pagedFile, "") |
| 389 | mockContent := make([]byte, DatabasePageSize*pagedFileBlockCount) |
| 390 | mockFile := NewMockReadWriterAt(mockContent) |
| 391 | |
| 392 | err := RestoreMissingPages(fileReader, mockFile) |
| 393 | |
| 394 | assert.NoError(t, err, "Expected no errors after restoring missing pages") |
| 395 | mockFileReader := bytes.NewReader(mockFile.content) |
| 396 | pagedFile.Seek(0, 0) |
| 397 | compareResult := deepCompareReaders(pagedFile, mockFileReader) |
| 398 | assert.Truef(t, compareResult, "Increment could not restore file") |
| 399 | } |
| 400 | |
| 401 | // Verify that all increment blocks exist in the resulting file |
| 402 | // and that each block has been written to the right place |
nothing calls this directly
no test coverage detected