mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-20 03:45:02 +00:00
Fix test bug in plugin cli progress tests
This commit is contained in:
parent
8db43c0107
commit
172ced3e2d
@ -69,19 +69,19 @@ public class ProgressInputStreamTests extends ESTestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void testOddBytes() throws Exception {
|
public void testOddBytes() throws Exception {
|
||||||
int odd = (randomIntBetween(100, 200) / 2) + 1;
|
int odd = randomIntBetween(10, 100) * 2 + 1;
|
||||||
ProgressInputStream is = newProgressInputStream(odd);
|
ProgressInputStream is = newProgressInputStream(odd);
|
||||||
for (int i = 0; i < odd; i++) {
|
for (int i = 0; i < odd; i++) {
|
||||||
is.checkProgress(1);
|
is.checkProgress(1);
|
||||||
}
|
}
|
||||||
is.checkProgress(-1);
|
is.checkProgress(-1);
|
||||||
|
|
||||||
assertThat(progresses, hasSize(odd+1));
|
assertThat(progresses, hasSize(Math.min(odd + 1, 100)));
|
||||||
assertThat(progresses, hasItem(100));
|
assertThat(progresses, hasItem(100));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testEvenBytes() throws Exception {
|
public void testEvenBytes() throws Exception {
|
||||||
int even = (randomIntBetween(100, 200) / 2);
|
int even = randomIntBetween(10, 100) * 2;
|
||||||
ProgressInputStream is = newProgressInputStream(even);
|
ProgressInputStream is = newProgressInputStream(even);
|
||||||
|
|
||||||
for (int i = 0; i < even; i++) {
|
for (int i = 0; i < even; i++) {
|
||||||
@ -89,7 +89,7 @@ public class ProgressInputStreamTests extends ESTestCase {
|
|||||||
}
|
}
|
||||||
is.checkProgress(-1);
|
is.checkProgress(-1);
|
||||||
|
|
||||||
assertThat(progresses, hasSize(even+1));
|
assertThat(progresses, hasSize(Math.min(even + 1, 100)));
|
||||||
assertThat(progresses, hasItem(100));
|
assertThat(progresses, hasItem(100));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user