Apache Lucene open-source search software
SOLR-11598: Fix test failure due to ordering of sub-tests
Varun Thackera254e7d7bcd1
diff --git a/solr/core/src/test/org/apache/solr/handler/export/TestExportWriter.java b/solr/core/src/test/org/apache/solr/handler/export/TestExportWriter.javaindex e431f472ba2..0d1a9a04bb3 100644--- a/solr/core/src/test/org/apache/solr/handler/export/TestExportWriter.java+++ b/solr/core/src/test/org/apache/solr/handler/export/TestExportWriter.java@@ -55,7 +55,7 @@ public class TestExportWriter extends SolrTestCaseJ4 {super.setUp();assertU(delQ("*:*"));assertU(commit());- createIndex();+}public static void createIndex() {@@ -148,6 +148,19 @@ public class TestExportWriter extends SolrTestCaseJ4 {}+ @Test+ public void test() throws Exception {+ clearIndex();+ createIndex();++ testSortingOutput();+ testExportRequiredParams();+ testDates();+ testDuplicates();++ clearIndex();+ }+@Testpublic void testSmallChains() throws Exception {clearIndex();@@ -331,8 +344,7 @@ public class TestExportWriter extends SolrTestCaseJ4 {" \"id\":\"2\"}]}}");}- @Test- public void testSortingOutput() throws Exception {+ private void testSortingOutput() throws Exception {//Test single value DocValue outputString s = h.query(req("q", "id:1", "qt", "/export", "fl", "floatdv,intdv,stringdv,longdv,doubledv", "sort", "intdv asc"));@@ -436,8 +448,7 @@ public class TestExportWriter extends SolrTestCaseJ4 {assertEquals(Utils.toJSONString(Utils.fromJSONString(expected)), Utils.toJSONString(Utils.fromJSONString(actual)));}- @Test- public void testExportRequiredParams() throws Exception {+ private void testExportRequiredParams() throws Exception {//Test whether missing required parameters returns expected errors.@@ -451,17 +462,15 @@ public class TestExportWriter extends SolrTestCaseJ4 {// Interesting you don't even need to specify a "q" parameter.}-- @Test- public void testDates() throws Exception {++ private void testDates() throws Exception {String s = h.query(req("q", "id:1", "qt", "/export", "fl", "datedv", "sort", "datedv asc"));assertJsonEquals(s, "{\"responseHeader\": {\"status\": 0}, \"response\":{\"numFound\":1, \"docs\":[{\"datedv\":\"2017-06-16T07:00:00Z\"}]}}");s = h.query(req("q", "id:1", "qt", "/export", "fl", "datedv_m", "sort", "datedv asc"));assertJsonEquals(s, "{\"responseHeader\": {\"status\": 0}, \"response\":{\"numFound\":1, \"docs\":[{\"datedv_m\":[\"2017-06-16T01:00:00Z\",\"2017-06-16T02:00:00Z\",\"2017-06-16T03:00:00Z\",\"2017-06-16T04:00:00Z\"]}]}}");}-- @Test- public void testDuplicates() throws Exception {++ private void testDuplicates() throws Exception {// see SOLR-10924String expected = h.getCore().getLatestSchema().getField("int_is_t").getType().isPointField()? "1,1,1,1" : "1";