[TEST] Fix off-by-one bug in corruptFile util function

The upper bound must be 0-based since we are corrupting an offset into
the file but it can be a 1-based length of the file which results in an
uncorrupted file.
This commit is contained in:
Simon Willnauer 2015-08-12 16:42:22 +02:00
parent ce00241440
commit ed9eef92dd
1 changed files with 1 additions and 1 deletions

View File

@ -655,7 +655,7 @@ public class StoreTest extends ESTestCase {
IndexOutput output = dir.createOutput(fileOut, IOContext.DEFAULT);
long len = input.length();
byte[] b = new byte[1024];
long broken = randomInt((int) len);
long broken = randomInt((int) len-1);
long pos = 0;
while (pos < len) {
int min = (int) Math.min(input.length() - pos, b.length);