igiguere commented on code in PR #4057: URL: https://github.com/apache/solr/pull/4057#discussion_r2764435574
########## solr/core/src/test/org/apache/solr/handler/admin/api/GetMetricsTest.java: ########## @@ -0,0 +1,283 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.solr.handler.admin.api; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.StandardCopyOption; +import java.security.KeyManagementException; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.UnrecoverableKeyException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import java.util.function.Consumer; +import org.apache.solr.SolrTestCaseJ4; +import org.apache.solr.client.solrj.SolrServerException; +import org.apache.solr.cloud.MiniSolrCloudCluster; +import org.apache.solr.response.PrometheusResponseWriter; +import org.apache.solr.util.SSLTestConfig; +import org.apache.solr.util.stats.MetricUtils; +import org.eclipse.jetty.client.ContentResponse; +import org.eclipse.jetty.client.HttpClient; +import org.eclipse.jetty.http.HttpFields.Mutable; +import org.eclipse.jetty.http.HttpHeader; +import org.eclipse.jetty.http.HttpMethod; +import org.eclipse.jetty.util.ssl.SslContextFactory; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +/** + * Unit tests for {@link GetMetrics}. + * + * <p>See also: TestMetricsRequest, in SolrJ + */ +public class GetMetricsTest extends SolrTestCaseJ4 { + + // No need for the full output + private static final int MAX_OUTPUT = 1024; + + private static final int TIMEOUT = 15000; + + private static HttpClient jettyHttpClient; + private static String metricsV2Url; + private static MiniSolrCloudCluster cluster; + + @BeforeClass + public static void beforeClass() throws Exception { + Path tempDir = createTempDir(); + copyMinConf(tempDir); + Files.copy( + SolrTestCaseJ4.TEST_PATH().resolve("solr.xml"), + tempDir.resolve("solr.xml"), + StandardCopyOption.REPLACE_EXISTING); + MiniSolrCloudCluster.Builder clusterBuilder = new MiniSolrCloudCluster.Builder(2, tempDir); + cluster = clusterBuilder.withSolrXml(tempDir.resolve("solr.xml")).build(); + + metricsV2Url = cluster.getJettySolrRunner(0).getBaseURLV2().toString().concat("/metrics"); + + // useSsl = true, clientAuth = false + SSLTestConfig sslConfig = new SSLTestConfig(true, false); Review Comment: Yeah! Solr Tests have passed in CI ! -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
