erasureReadFile and erasureCreateFile testcases. (#2229)

* unit-tests: Unit tests for erasureCreateFile and erasureReadFile.

* appendFile() should return errXLWriteQuorum.

* TestErasureReadFileOffsetLength() tests erasureReadFile() for different offset and lengths.

* Fix for the failure seen in the erasure read unit test case. Issue #2227

* Move common erasure setup code to newErasureTestSetup()

* Review fixes. Add few more test cases for erasureReadFile.
This commit is contained in:
Krishna Srinivas
2016-07-19 12:26:16 +05:30
committed by Harshavardhana
parent 1f706e067d
commit 897d78d113
6 changed files with 283 additions and 56 deletions

View File

@@ -262,14 +262,17 @@ func erasureReadFile(writer io.Writer, disks []StorageAPI, volume string, path s
}
var outSize, outOffset int64
// If this is start block, skip unwanted bytes.
if block == startBlock {
outOffset = bytesToSkip
}
// Total data to be read.
outSize = blockSize
if length-bytesWritten < blockSize {
// If this is start block, skip unwanted bytes.
if block == startBlock {
outOffset = bytesToSkip
outSize -= bytesToSkip
}
if length-bytesWritten < outSize {
// We should not send more data than what was requested.
outSize = length - bytesWritten
}