Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-16585: bypass empty update in the test (#1454)

Mikhail Khludnev30588947747d
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java
index 3f5f82658de..b49199f5cd8 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java
@@ -590,13 +590,15 @@ public abstract class SolrExampleTests extends SolrExampleTestsBase {
doc.addField("name", "doc" + i);
doc.addField("price", "" + i);
docs.add(doc);
- if (rarely()) {
+ if (rarely() && !docs.isEmpty()) {
client.add(docs);
client.commit();
docs.clear();
}
}
- client.add(docs);
+ if (!docs.isEmpty()) {
+ client.add(docs);
+ }
if (random().nextBoolean()) {
client.commit();
} else {