Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.5.1, 6.0
    • Component/s: None
    • Labels:
      None

      Description

      At the moment, if you want to write unit tests for Cloud components, you have to extend AbstractDistribZkTestCase, which has a number of disadvantages:

      • the API isn't well-documented
      • you get a default configuration loaded into ZK, and it's not trivial to add separate ones
      • you get a default collection, whether you want one or not
      • the test cluster isn't static, which means that it's started up and shutdown after every test function. To avoid tests being incredibly slow, we end up writing single-function tests that call out to sub-functions, losing the benefits of execution-order randomization.

      It would be more useful to have a properly configurable and documented testcase base class.

      1. SOLR-8758.patch
        5 kB
        Alan Woodward

        Issue Links

          Activity

          Hide
          romseygeek Alan Woodward added a comment -

          Here's a patch. The base class uses a MiniSolrCloudCluster, and exposes a Builder interface to configure it. You can give it a solr.xml (either as a Path or a String), and add configs that will be uploaded when the cluster starts.

          I initially wanted to implement this as a junit ExternalResource that could be added as a ClassRule, but unfortunately this puts it outside the BeforeClass/AfterClass boundaries of LuceneTestCase and it falls foul of things like the ThreadLeak tracker.

          Show
          romseygeek Alan Woodward added a comment - Here's a patch. The base class uses a MiniSolrCloudCluster, and exposes a Builder interface to configure it. You can give it a solr.xml (either as a Path or a String), and add configs that will be uploaded when the cluster starts. I initially wanted to implement this as a junit ExternalResource that could be added as a ClassRule, but unfortunately this puts it outside the BeforeClass/AfterClass boundaries of LuceneTestCase and it falls foul of things like the ThreadLeak tracker.
          Hide
          tomasflobbe Tomás Fernández Löbbe added a comment -

          +1! AbstractDistribZkTestCase also creates the "control Jetty vs distrib" by default, which is not always something you need.

          Show
          tomasflobbe Tomás Fernández Löbbe added a comment - +1! AbstractDistribZkTestCase also creates the "control Jetty vs distrib" by default, which is not always something you need.
          Hide
          markrmiller@gmail.com Mark Miller added a comment -

          We also need to move from that pattern to get rid of legacyCloud=true and finish zk=truth. We can't have all those tests with predefined cores.

          Show
          markrmiller@gmail.com Mark Miller added a comment - We also need to move from that pattern to get rid of legacyCloud=true and finish zk=truth. We can't have all those tests with predefined cores.
          Hide
          romseygeek Alan Woodward added a comment -

          Yes, once this is committed we can start cutting over the tests one-by-one. SOLR-8323 should help here as well.

          Show
          romseygeek Alan Woodward added a comment - Yes, once this is committed we can start cutting over the tests one-by-one. SOLR-8323 should help here as well.
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 9a3458f69328045a8c62acc826f3012edeb154c6 in lucene-solr's branch refs/heads/master from Alan Woodward
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=9a3458f ]

          SOLR-8758: Add SolrCloudTestCase base class

          Show
          jira-bot ASF subversion and git services added a comment - Commit 9a3458f69328045a8c62acc826f3012edeb154c6 in lucene-solr's branch refs/heads/master from Alan Woodward [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=9a3458f ] SOLR-8758 : Add SolrCloudTestCase base class
          Hide
          romseygeek Alan Woodward added a comment -

          Thanks for the review gents.

          Show
          romseygeek Alan Woodward added a comment - Thanks for the review gents.
          Hide
          anshumg Anshum Gupta added a comment -

          I'll also back port this to 5x for 5.5.1 so that the bug fixes and tests that use SolrCloudTestCase base class from master/6.0 can be easily back ported.

          Show
          anshumg Anshum Gupta added a comment - I'll also back port this to 5x for 5.5.1 so that the bug fixes and tests that use SolrCloudTestCase base class from master/6.0 can be easily back ported.
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 27e284bb7bcd6536b3c017d76e675f24397cce9c in lucene-solr's branch refs/heads/branch_5x from Alan Woodward
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=27e284b ]

          SOLR-8758: Add SolrCloudTestCase base class

          Show
          jira-bot ASF subversion and git services added a comment - Commit 27e284bb7bcd6536b3c017d76e675f24397cce9c in lucene-solr's branch refs/heads/branch_5x from Alan Woodward [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=27e284b ] SOLR-8758 : Add SolrCloudTestCase base class
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 4a274605b8b426029276b9cccec78a23c095e0da in lucene-solr's branch refs/heads/branch_5_5 from Alan Woodward
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=4a27460 ]

          SOLR-8758: Add SolrCloudTestCase base class

          Show
          jira-bot ASF subversion and git services added a comment - Commit 4a274605b8b426029276b9cccec78a23c095e0da in lucene-solr's branch refs/heads/branch_5_5 from Alan Woodward [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=4a27460 ] SOLR-8758 : Add SolrCloudTestCase base class

            People

            • Assignee:
              Unassigned
              Reporter:
              romseygeek Alan Woodward
            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development