mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-25 22:36:20 +00:00
[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:
parent
ce00241440
commit
ed9eef92dd
@ -655,7 +655,7 @@ public class StoreTest extends ESTestCase {
|
|||||||
IndexOutput output = dir.createOutput(fileOut, IOContext.DEFAULT);
|
IndexOutput output = dir.createOutput(fileOut, IOContext.DEFAULT);
|
||||||
long len = input.length();
|
long len = input.length();
|
||||||
byte[] b = new byte[1024];
|
byte[] b = new byte[1024];
|
||||||
long broken = randomInt((int) len);
|
long broken = randomInt((int) len-1);
|
||||||
long pos = 0;
|
long pos = 0;
|
||||||
while (pos < len) {
|
while (pos < len) {
|
||||||
int min = (int) Math.min(input.length() - pos, b.length);
|
int min = (int) Math.min(input.length() - pos, b.length);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user