epugh commented on a change in pull request #2430:
URL: https://github.com/apache/lucene-solr/pull/2430#discussion_r583225058



##########
File path: solr/core/src/test/org/apache/solr/security/JWTIssuerConfigTest.java
##########
@@ -144,13 +172,29 @@ public void wellKnownConfigFromString() throws 
IOException {
     assertEquals(Arrays.asList("code", "code id_token", "code token", "code 
id_token token", "token", "id_token", "id_token token"), 
config.getResponseTypesSupported());
   }
 
-  @Test(expected = SolrException.class)
-  public void wellKnownConfigNotHttps() {
-    
JWTIssuerConfig.WellKnownDiscoveryConfig.parse("http://127.0.0.1:45678/.well-known/config";);
+  @Test
+  public void wellKnownConfigWithHttpLogsAWarning() {
+    
+    LogWatcherConfig watcherCfg = new LogWatcherConfig(true, null, "WARN", 
100);
+    @SuppressWarnings({"rawtypes"})
+    LogWatcher watcher = LogWatcher.newRegisteredLogWatcher(watcherCfg, null);
+    
+    watcher.reset();
+    
+    // currently we throw an exception because we can't open a connection to 
this fake url and can't mock it.
+    expectThrows(SolrException.class, () -> 
JWTIssuerConfig.WellKnownDiscoveryConfig.parse("http://127.0.0.1:45678/.well-known/config";));

Review comment:
       This is different than `wellKnownConfigNotREachable`, in that test we 
confirm we get an excpetion when you open a connection a not reachable url.   
This one is JUST supposed to test the `http` logs a warning.  However, the code 
path then opens a connection to the url, triggering the SolrException (just 
like in `wellKnownConfigNotReachable`).    I really wanted a mock for the 
actually http call, and I tried gettign soemthign to work with mockito, but it 
started me down refactorign a lot of code, so I stopped....   




----------------------------------------------------------------
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.

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



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

Reply via email to