gerlowskija commented on code in PR #2144: URL: https://github.com/apache/solr/pull/2144#discussion_r1453453346
########## solr/core/src/test/org/apache/solr/handler/admin/api/RequestCoreCommandStatusTest.java: ########## @@ -0,0 +1,164 @@ +/* + * 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 static org.apache.http.HttpStatus.SC_OK; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.Map; +import javax.ws.rs.core.Application; +import javax.ws.rs.core.Response; +import org.apache.solr.SolrTestCaseJ4; +import org.apache.solr.core.CoreContainer; +import org.apache.solr.handler.admin.CoreAdminHandler; +import org.apache.solr.jersey.InjectionFactories; +import org.apache.solr.jersey.SolrJacksonMapper; +import org.apache.solr.request.SolrQueryRequest; +import org.apache.solr.response.SolrQueryResponse; +import org.glassfish.hk2.api.Factory; +import org.glassfish.hk2.utilities.binding.AbstractBinder; +import org.glassfish.jersey.process.internal.RequestScoped; +import org.glassfish.jersey.server.ResourceConfig; +import org.glassfish.jersey.test.JerseyTest; +import org.junit.BeforeClass; +import org.junit.Test; + +/** Test for {@link RequestCoreCommandStatus}. */ +public class RequestCoreCommandStatusTest extends JerseyTest { Review Comment: Agreed - I also really like the "level" that `JerseyTest` allows us to validate - being able to test that the HTTP path, request body, etc. match what you expect is really valuable. And I've pulled the code down locally and agree that the test passes as-is. It's a good test 👍 The problem is the base-class, `JerseyTest`. Generally in Solr's test suite, we want to support users running any number of tests in parallel (or even running the same test 'N' times in parallel) without any conflicts. Solr's base classes (SolrTestCase, SolrTestCaseJ4, etc.) have a good bit of logic built into them to support this: locking around how ports are allocated when starting test servers, ensuring system properties are cleared in between tests to avoid any spillover, tracking "Closable" resources to detect memory leaks, etc. `JerseyTest` doesn't provide a lot of these "good citizen" guarantees though. I accidentally broke the build earlier this year when adding a `JerseyTest` subclass for another API. (I'm hazy on the specifics, but I think that whenever two `JerseyTest`-based tests ran at the same time they ended up "choosing" the same port for the test server and failing.) It's definitely fixable - we could probably look at what `JerseyTest` is actually doing and come up with a `public class SolrJerseyTest extends SolrTestCase` that brings the best of both worlds together. But that doesn't exist yet, so I've been trying to use JerseyTest sparingly for now. -- 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