[ 
https://issues.apache.org/jira/browse/SOLR-13846?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16953559#comment-16953559
 ] 

Jan Høydahl commented on SOLR-13846:
------------------------------------

Do you think this test error can be caused by this?

[https://builds.apache.org/job/Lucene-Solr-Tests-8.3/56/testReport/junit/org.apache.solr.security/BasicAuthOnSingleNodeTest/basicTest/]

> 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

Reply via email to