Github user tomjon commented on a diff in the pull request: https://github.com/apache/lucene-solr/pull/37#discussion_r63668312 --- Diff: solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java --- @@ -70,357 +77,193 @@ import org.apache.solr.common.cloud.ZkStateReader; import org.apache.solr.common.params.CollectionParams.CollectionAction; import org.apache.solr.common.params.CoreAdminParams; -import org.apache.solr.common.params.MapSolrParams; import org.apache.solr.common.params.ModifiableSolrParams; import org.apache.solr.common.util.NamedList; -import org.apache.solr.common.util.SimpleOrderedMap; import org.apache.solr.common.util.StrUtils; import org.apache.solr.core.CoreContainer; import org.apache.solr.core.SolrCore; import org.apache.solr.core.SolrInfoMBean.Category; import org.apache.solr.util.TestInjection; import org.apache.solr.util.TimeOut; +import org.junit.After; +import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import static org.apache.solr.cloud.OverseerCollectionMessageHandler.NUM_SLICES; -import static org.apache.solr.common.cloud.ZkStateReader.CORE_NAME_PROP; -import static org.apache.solr.common.cloud.ZkStateReader.MAX_SHARDS_PER_NODE; -import static org.apache.solr.common.cloud.ZkStateReader.REPLICATION_FACTOR; -import static org.apache.solr.common.util.Utils.makeMap; - /** * Tests the Cloud Collections API. */ @Slow -public class CollectionsAPIDistributedZkTest extends AbstractFullDistribZkTestBase { +public class CollectionsAPIDistributedZkTest extends SolrCloudTestCase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - - private static final String DEFAULT_COLLECTION = "collection1"; + + private static final int NODE_COUNT = 5; // we randomly use a second config set rather than just one - private boolean secondConfigSet = random().nextBoolean(); + private final boolean secondConfigSet = false; //random().nextBoolean(); FIXME + private final String configSet = secondConfigSet ? "conf1": "conf2"; + + private static CloudSolrClient cloudClient; + private static ZkTestServer zkServer; @BeforeClass - public static void beforeCollectionsAPIDistributedZkTest() { + public static void setup() throws Exception { + configureCluster(NODE_COUNT) + .addConfig("conf1", TEST_PATH().resolve("configsets").resolve("cloud-jmx").resolve("conf")) + .addConfig("conf2", TEST_PATH().resolve("configsets").resolve("cloud-jmx").resolve("conf")) + .configure(); + + cloudClient = cluster.buildSolrClient(random().nextBoolean()); + cloudClient.setParallelUpdates(random().nextBoolean()); + cloudClient.connect(); + + zkServer = cluster.getZkServer(); + TestInjection.randomDelayInCoreCreation = "true:20"; System.setProperty("validateAfterInactivity", "200"); } - - @Override - public void distribSetUp() throws Exception { - super.distribSetUp(); - - if (secondConfigSet ) { - String zkHost = zkServer.getZkHost(); - String zkAddress = zkServer.getZkAddress(); - SolrZkClient zkClient = new SolrZkClient(zkHost, AbstractZkTestCase.TIMEOUT); - zkClient.makePath("/solr", false, true); - zkClient.close(); - - zkClient = new SolrZkClient(zkAddress, AbstractZkTestCase.TIMEOUT); - File solrhome = new File(TEST_HOME()); - - // for now, always upload the config and schema to the canonical names - AbstractZkTestCase.putConfig("conf2", zkClient, solrhome, getCloudSolrConfig(), "solrconfig.xml"); - AbstractZkTestCase.putConfig("conf2", zkClient, solrhome, "schema.xml", "schema.xml"); - AbstractZkTestCase.putConfig("conf2", zkClient, solrhome, "enumsConfig.xml", "enumsConfig.xml"); - - AbstractZkTestCase.putConfig("conf2", zkClient, solrhome, "solrconfig.snippet.randomindexconfig.xml"); - AbstractZkTestCase.putConfig("conf2", zkClient, solrhome, "stopwords.txt"); - AbstractZkTestCase.putConfig("conf2", zkClient, solrhome, "protwords.txt"); - AbstractZkTestCase.putConfig("conf2", zkClient, solrhome, "currency.xml"); - AbstractZkTestCase.putConfig("conf2", zkClient, solrhome, "open-exchange-rates.json"); - AbstractZkTestCase.putConfig("conf2", zkClient, solrhome, "mapping-ISOLatin1Accent.txt"); - AbstractZkTestCase.putConfig("conf2", zkClient, solrhome, "old_synonyms.txt"); - AbstractZkTestCase.putConfig("conf2", zkClient, solrhome, "synonyms.txt"); - AbstractZkTestCase.putConfig("conf2", zkClient, solrhome, "elevate.xml"); - zkClient.close(); - } + @AfterClass --- End diff -- Actually, I at least need to close() the zkServer, as this (50% of the time) gets replaced by a new one when restarting Zookeeper.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org