[ https://issues.apache.org/jira/browse/SOLR-13846?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16953284#comment-16953284 ]
ASF subversion and git services commented on SOLR-13846: -------------------------------------------------------- Commit 25968e3b75e5e9a4f2a64de10500aae10a257bdd in lucene-solr's branch refs/heads/branch_8_3 from Chris M. Hostetter [ https://gitbox.apache.org/repos/asf?p=lucene-solr.git;h=25968e3 ] SOLR-13846: workaround - elliminate use of problematic PreemptiveBasicAuthClientBuilderFactory in tests that don't need it (cherry picked from commit 939b3364e604a4a16b3c4c5f278c4d7f30f1354b) > PreemptiveBasicAuthClientBuilderFactory use of static code blocks makes it > unreliable in tests > ---------------------------------------------------------------------------------------------- > > Key: SOLR-13846 > URL: https://issues.apache.org/jira/browse/SOLR-13846 > Project: Solr > Issue Type: Bug > Security Level: Public(Default Security Level. Issues are Public) > Reporter: Chris M. Hostetter > Priority: Major > > PreemptiveBasicAuthClientBuilderFactory uses static code blocks to initialize > global static variables in a way that makes it largely unusable in tests. > Notably: it uses {{System.getProperty(...)}} during classloading to read > system properties that then affect the behavior of all future instances -- > even if an individual test explicitly sets the system property in question > before instaniating instances of this class. > This means that if two tests that both use instances of > PreemptiveBasicAuthClientBuilderFactory run in the same JVM, only the system > properties set in the first test will be used by > PreemptiveBasicAuthClientBuilderFactory in the *second* test (even those the > system properties get reset by the test framework between runs) > There are currently two tests using PreemptiveBasicAuthClientBuilderFactory, > and depending on the order they run, one will fail... > {noformat} > $ ant test -Dtests.jvms=1 > '-Dtests.class=*.TestQueryingOnDownCollection|*.BasicAuthOnSingleNodeTest' > -Dtests.seed=EC8FB67A91689F48 -Dtests.slow=true -Dtests.badapples=true > -Dtests.locale=sl -Dtests.timezone=Asia/Baghdad -Dtests.asserts=true > -Dtests.file.encoding=US-ASCII > ... > [junit4] 2> NOTE: reproduce with: ant test > -Dtestcase=BasicAuthOnSingleNodeTest -Dtests.method=basicTest > -Dtests.seed=EC8FB67A91689F48 -Dtests.slow=true -Dtests.badapples=true > -Dtests.locale=sl -Dtests.timezone=Asia/Baghdad -Dtests.asserts=true > -Dtests.file.encoding=US-ASCII > [junit4] ERROR 4.05s | BasicAuthOnSingleNodeTest.basicTest <<< > [junit4] > Throwable #1: > org.apache.solr.client.solrj.impl.BaseHttpSolrClient$RemoteSolrException: > Error from server at http://127.0.0.1:37047/solr: Expected mime type > application/octet-stream but got text/html. <html> > [junit4] > <head> > [junit4] > <meta http-equiv="Content-Type" > content="text/html;charset=utf-8"/> > [junit4] > <title>Error 401 Bad credentials</title> > [junit4] > </head> > [junit4] > <body><h2>HTTP ERROR 401</h2> > [junit4] > <p>Problem accessing /solr/authCollection/select. Reason: > [junit4] > <pre> Bad credentials</pre></p><hr><a > href="http://eclipse.org/jetty">Powered by Jetty:// 9.4.19.v20190610</a><hr/> > [junit4] > </body> > [junit4] > </html> > [junit4] > at > __randomizedtesting.SeedInfo.seed([EC8FB67A91689F48:1E7BA118D5CD927B]:0) > [junit4] > at > org.apache.solr.client.solrj.impl.Http2SolrClient.processErrorsAndResponse(Http2SolrClient.java:696) > [junit4] > at > org.apache.solr.client.solrj.impl.Http2SolrClient.request(Http2SolrClient.java:402) > [junit4] > at > org.apache.solr.client.solrj.impl.Http2SolrClient.request(Http2SolrClient.java:754) > [junit4] > at > org.apache.solr.client.solrj.SolrRequest.process(SolrRequest.java:207) > [junit4] > at > org.apache.solr.client.solrj.SolrClient.query(SolrClient.java:1003) > [junit4] > at > org.apache.solr.security.BasicAuthOnSingleNodeTest.basicTest(BasicAuthOnSingleNodeTest.java:72) > [junit4] > at > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > [junit4] > at > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > [junit4] > at > java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > [junit4] > at > java.base/java.lang.reflect.Method.invoke(Method.java:566) > [junit4] > at java.base/java.lang.Thread.run(Thread.java:834) > {noformat} -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org