You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2020/09/08 05:00:18 UTC
[lucene-solr] 03/03: @808 Couple test fixes.
This is an automated email from the ASF dual-hosted git repository.
markrmiller pushed a commit to branch reference_impl_dev
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
commit f2369e1cb34ba93bf68bbb7341b83ebb7f77c61f
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Mon Sep 7 23:58:00 2020 -0500
@808 Couple test fixes.
---
.../scraper/SolrStandaloneScraperTest.java | 14 +++++--------
.../solr/client/solrj/request/SchemaTest.java | 23 ++++------------------
2 files changed, 9 insertions(+), 28 deletions(-)
diff --git a/solr/contrib/prometheus-exporter/src/test/org/apache/solr/prometheus/scraper/SolrStandaloneScraperTest.java b/solr/contrib/prometheus-exporter/src/test/org/apache/solr/prometheus/scraper/SolrStandaloneScraperTest.java
index 788c4e6..39a23fa 100644
--- a/solr/contrib/prometheus-exporter/src/test/org/apache/solr/prometheus/scraper/SolrStandaloneScraperTest.java
+++ b/solr/contrib/prometheus-exporter/src/test/org/apache/solr/prometheus/scraper/SolrStandaloneScraperTest.java
@@ -29,6 +29,7 @@ import org.apache.commons.io.FileUtils;
import org.apache.solr.client.solrj.impl.Http2SolrClient;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.client.solrj.impl.NoOpResponseParser;
+import org.apache.solr.common.ParWork;
import org.apache.solr.common.util.ExecutorUtil;
import org.apache.solr.common.util.IOUtils;
import org.apache.solr.prometheus.PrometheusExporterTestBase;
@@ -42,7 +43,6 @@ import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
-@Ignore // nocommit debug
public class SolrStandaloneScraperTest extends RestTestBase {
private static MetricsConfiguration configuration;
@@ -67,8 +67,8 @@ public class SolrStandaloneScraperTest extends RestTestBase {
true,
null);
- executor = ExecutorUtil.newMDCAwareFixedThreadPool(25, new SolrNamedThreadFactory("solr-cloud-scraper-tests"));
- configuration = Helpers.loadConfiguration("conf/prometheus-solr-exporter-scraper-test-config.xml");
+ executor = ParWork.getMyPerThreadExecutor();
+ configuration = Helpers.loadConfiguration(TEST_PATH().resolve("..").resolve("conf").resolve("prometheus-solr-exporter-scraper-test-config.xml").toString());
solrClient = getHttpSolrClient(restTestHarness.getAdminURL());
solrScraper = new SolrStandaloneScraper(solrClient, executor);
@@ -85,15 +85,9 @@ public class SolrStandaloneScraperTest extends RestTestBase {
public static void cleanUp() throws Exception {
IOUtils.closeQuietly(solrScraper);
IOUtils.closeQuietly(solrClient);
- cleanUpHarness();
if (null != executor) {
- executor.shutdownNow();
executor = null;
}
- if (null != jetty) {
- jetty.stop();
- jetty = null;
- }
solrScraper = null;
solrClient = null;
}
@@ -107,6 +101,7 @@ public class SolrStandaloneScraperTest extends RestTestBase {
}
@Test
+ @Ignore // nocommit debug
public void pingCores() throws Exception {
Map<String, MetricSamples> allCoreMetrics = solrScraper.pingAllCores(
configuration.getPingConfiguration().get(0));
@@ -132,6 +127,7 @@ public class SolrStandaloneScraperTest extends RestTestBase {
}
@Test
+ @Ignore // nocommit debug - probably just that metrics are not instant
public void metricsForHost() throws Exception {
Map<String, MetricSamples> metricsByHost = solrScraper.metricsForAllHosts(configuration.getMetricsConfiguration().get(0));
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java
index 3fd1341..277cca0 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/request/SchemaTest.java
@@ -29,6 +29,7 @@ import java.util.TreeMap;
import org.apache.commons.io.FileUtils;
import org.apache.solr.client.solrj.SolrClient;
+import org.apache.solr.client.solrj.embedded.JettySolrRunner;
import org.apache.solr.client.solrj.impl.BaseHttpSolrClient;
import org.apache.solr.client.solrj.request.schema.AnalyzerDefinition;
import org.apache.solr.client.solrj.request.schema.FieldTypeDefinition;
@@ -59,6 +60,8 @@ import static org.hamcrest.CoreMatchers.is;
* {@link SchemaRequest} and {@link SchemaResponse}.
*/
public class SchemaTest extends RestTestBase {
+ private static JettySolrRunner jetty;
+
private static void assertValidSchemaResponse(SolrResponseBase schemaResponse) {
assertEquals("Response contained errors: " + schemaResponse.toString(), 0, schemaResponse.getStatus());
assertNull("Response contained errors: " + schemaResponse.toString(), schemaResponse.getResponse().get("errors"));
@@ -115,34 +118,16 @@ public class SchemaTest extends RestTestBase {
System.setProperty("managed.schema.mutable", "true");
System.setProperty("enable.update.log", "false");
- createJettyAndHarness(tmpSolrHome.getAbsolutePath(), "solrconfig-managed-schema.xml", "schema.xml",
+ jetty = createJettyAndHarness(tmpSolrHome.getAbsolutePath(), "solrconfig-managed-schema.xml", "schema.xml",
"/solr", true, extraServlets);
}
- @After
- public void cleanup() throws Exception {
-// if (jetty != null) {
-// jetty.stop();
-// jetty = null;
-// }
-// if (restTestHarness != null) {
-// restTestHarness.close();
-// }
-// restTestHarness = null;
-
- }
-
@AfterClass
public static void afterSchemaTest() throws Exception {
if (jetty != null) {
jetty.stop();
jetty = null;
}
- if (restTestHarness != null) {
- restTestHarness.close();
- }
- restTestHarness = null;
-
}
@Test