mirror of https://github.com/apache/lucene.git
SOLR-8996: Greatly decreases the probability of a RandomStream test failure from 1 in 5! to 1 in 1000!
This commit is contained in:
parent
8b56f67adb
commit
06a675ce2c
|
@ -482,13 +482,12 @@ public class StreamExpressionTest extends SolrCloudTestCase {
|
||||||
@Test
|
@Test
|
||||||
public void testRandomStream() throws Exception {
|
public void testRandomStream() throws Exception {
|
||||||
|
|
||||||
new UpdateRequest()
|
UpdateRequest update = new UpdateRequest();
|
||||||
.add(id, "0", "a_s", "hello0", "a_i", "0", "a_f", "0")
|
for(int idx = 0; idx < 1000; ++idx){
|
||||||
.add(id, "2", "a_s", "hello2", "a_i", "2", "a_f", "0")
|
String idxString = new Integer(idx).toString();
|
||||||
.add(id, "3", "a_s", "hello3", "a_i", "3", "a_f", "3")
|
update.add(id,idxString, "a_s", "hello" + idxString, "a_i", idxString, "a_f", idxString);
|
||||||
.add(id, "4", "a_s", "hello4", "a_i", "4", "a_f", "4")
|
}
|
||||||
.add(id, "1", "a_s", "hello1", "a_i", "1", "a_f", "1")
|
update.commit(cluster.getSolrClient(), COLLECTION);
|
||||||
.commit(cluster.getSolrClient(), COLLECTION);
|
|
||||||
|
|
||||||
StreamExpression expression;
|
StreamExpression expression;
|
||||||
TupleStream stream;
|
TupleStream stream;
|
||||||
|
@ -503,17 +502,17 @@ public class StreamExpressionTest extends SolrCloudTestCase {
|
||||||
try {
|
try {
|
||||||
context.setSolrClientCache(cache);
|
context.setSolrClientCache(cache);
|
||||||
|
|
||||||
expression = StreamExpressionParser.parse("random(" + COLLECTION + ", q=\"*:*\", rows=\"10\", fl=\"id, a_i\")");
|
expression = StreamExpressionParser.parse("random(" + COLLECTION + ", q=\"*:*\", rows=\"1000\", fl=\"id, a_i\")");
|
||||||
stream = factory.constructStream(expression);
|
stream = factory.constructStream(expression);
|
||||||
stream.setStreamContext(context);
|
stream.setStreamContext(context);
|
||||||
List<Tuple> tuples1 = getTuples(stream);
|
List<Tuple> tuples1 = getTuples(stream);
|
||||||
assert (tuples1.size() == 5);
|
assert (tuples1.size() == 1000);
|
||||||
|
|
||||||
expression = StreamExpressionParser.parse("random(" + COLLECTION + ", q=\"*:*\", rows=\"10\", fl=\"id, a_i\")");
|
expression = StreamExpressionParser.parse("random(" + COLLECTION + ", q=\"*:*\", rows=\"1000\", fl=\"id, a_i\")");
|
||||||
stream = factory.constructStream(expression);
|
stream = factory.constructStream(expression);
|
||||||
stream.setStreamContext(context);
|
stream.setStreamContext(context);
|
||||||
List<Tuple> tuples2 = getTuples(stream);
|
List<Tuple> tuples2 = getTuples(stream);
|
||||||
assert (tuples2.size() == 5);
|
assert (tuples2.size() == 1000);
|
||||||
|
|
||||||
boolean different = false;
|
boolean different = false;
|
||||||
for (int i = 0; i < tuples1.size(); i++) {
|
for (int i = 0; i < tuples1.size(); i++) {
|
||||||
|
|
Loading…
Reference in New Issue