epugh commented on code in PR #1957:
URL: https://github.com/apache/solr/pull/1957#discussion_r1336201491


##########
solr/prometheus-exporter/src/test/org/apache/solr/prometheus/scraper/SolrStandaloneScraperTest.java:
##########
@@ -47,42 +54,45 @@ public class SolrStandaloneScraperTest extends RestTestBase 
{
 
   @BeforeClass
   public static void setupBeforeClass() throws Exception {
-    File tmpSolrHome = createTempDir().toFile();
-    tmpSolrHome.deleteOnExit();
-
-    FileUtils.copyDirectory(new File(TEST_HOME()), 
tmpSolrHome.getAbsoluteFile());
-
-    initCore("solrconfig.xml", "managed-schema");
+    solrRule.startSolr(LuceneTestCase.createTempDir());
 
-    createJettyAndHarness(
-        tmpSolrHome.getAbsolutePath(), "solrconfig.xml", "managed-schema", 
"/solr", true, null);
+    Path configSet = LuceneTestCase.createTempDir();
+    createConf(configSet);
+    solrRule.newCollection().withConfigSet(configSet.toString()).create();
 
+    PrometheusExporterSettings settings = 
PrometheusExporterSettings.builder().build();
+    SolrScrapeConfiguration scrapeConfiguration =
+        SolrScrapeConfiguration.standalone(solrRule.getBaseUrl());
+    solrClient =
+        new SolrClientFactory(settings, scrapeConfiguration)
+            .createStandaloneSolrClient(solrRule.getBaseUrl());
     executor =
         ExecutorUtil.newMDCAwareFixedThreadPool(
             25, new SolrNamedThreadFactory("solr-cloud-scraper-tests"));
     configuration =
         
Helpers.loadConfiguration("conf/prometheus-solr-exporter-scraper-test-config.xml");
-
-    solrClient =
-        new Http2SolrClient.Builder(restTestHarness.getAdminURL())
-            .withResponseParser(new NoOpResponseParser("json"))
-            .build();
     solrScraper = new SolrStandaloneScraper(solrClient, executor, "test");
 
     Helpers.indexAllDocs(solrClient);
   }
 
+  public static void createConf(Path configSet) throws IOException {
+    Path subHome = configSet.resolve("conf");
+    Files.createDirectories(subHome);
+
+    Path top = 
SolrTestCaseJ4.TEST_PATH().resolve("collection1").resolve("conf");
+    Files.copy(top.resolve("managed-schema.xml"), 
subHome.resolve("schema.xml"));
+    Files.copy(top.resolve("solrconfig.xml"), 
subHome.resolve("solrconfig.xml"));
+
+    Files.copy(top.resolve("stopwords.txt"), subHome.resolve("stopwords.txt"));

Review Comment:
   makes sense.  Maybe someday we figure out how many tests actually want 
stopwords, or which ones want stopwords, and only have those tests depend on it!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to