You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2020/11/16 20:17:11 UTC

[lucene-solr] branch reference_impl_dev updated: @1237 Add a way to start bringing in non Nightly ssl specific tests.

This is an automated email from the ASF dual-hosted git repository.

markrmiller pushed a commit to branch reference_impl_dev
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/reference_impl_dev by this push:
     new 157acc2  @1237 Add a way to start bringing in non Nightly ssl specific tests.
157acc2 is described below

commit 157acc24f35561077a5ba3fbc2fd0789463d37ce
Author: markrmiller@gmail.com <ma...@gmail.com>
AuthorDate: Mon Nov 16 14:11:46 2020 -0600

    @1237 Add a way to start bringing in non Nightly ssl specific tests.
---
 .../solr/client/solrj/embedded/JettySolrRunner.java   |  2 +-
 .../solrj/impl/HttpSolrClientSSLAuthConPoolTest.java  |  3 ++-
 .../src/java/org/apache/solr/SolrTestCase.java        | 19 ++++++++++++++++---
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/client/solrj/embedded/JettySolrRunner.java b/solr/core/src/java/org/apache/solr/client/solrj/embedded/JettySolrRunner.java
index dac6006..66ddc1e 100644
--- a/solr/core/src/java/org/apache/solr/client/solrj/embedded/JettySolrRunner.java
+++ b/solr/core/src/java/org/apache/solr/client/solrj/embedded/JettySolrRunner.java
@@ -347,7 +347,7 @@ public class JettySolrRunner implements Closeable {
         http2ConnectionFactory.setStreamIdleTimeout(TimeUnit.MINUTES.toMillis(10));
 
         ALPNServerConnectionFactory alpn = new ALPNServerConnectionFactory(http2ConnectionFactory.getProtocol(), http1ConnectionFactory.getProtocol());
-        alpn.setDefaultProtocol(http2ConnectionFactory.getProtocol());
+        alpn.setDefaultProtocol(http1ConnectionFactory.getProtocol());
         connector.addConnectionFactory(alpn);
         connector.addConnectionFactory(http1ConnectionFactory);
         connector.addConnectionFactory(http2ConnectionFactory);
diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientSSLAuthConPoolTest.java b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientSSLAuthConPoolTest.java
index 566441f..09d1cde 100644
--- a/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientSSLAuthConPoolTest.java
+++ b/solr/solrj/src/test/org/apache/solr/client/solrj/impl/HttpSolrClientSSLAuthConPoolTest.java
@@ -19,12 +19,13 @@ package org.apache.solr.client.solrj.impl;
 
 import java.util.Arrays;
 
+import org.apache.solr.SolrTestCase;
 import org.apache.solr.util.RandomizeSSL;
 import org.junit.BeforeClass;
 import org.junit.Ignore;
 
 @RandomizeSSL(1.0)
-@Ignore // nocommit debug
+@SolrTestCase.AlwaysUseSSL
 public class HttpSolrClientSSLAuthConPoolTest extends HttpSolrClientConPoolTest {
 
     @BeforeClass
diff --git a/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java b/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java
index 0b14747..fa021fb 100644
--- a/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java
+++ b/solr/test-framework/src/java/org/apache/solr/SolrTestCase.java
@@ -170,6 +170,17 @@ public class SolrTestCase extends LuceneTestCase {
   }
 
   /**
+   * Annotation for test classes that always need SSL
+   */
+  @Documented
+  @Inherited
+  @Retention(RetentionPolicy.RUNTIME)
+  @Target(ElementType.TYPE)
+  public @interface AlwaysUseSSL {
+
+  }
+
+  /**
    * Annotation for test classes that want to disable SSL
    */
   @Documented
@@ -558,13 +569,15 @@ public class SolrTestCase extends LuceneTestCase {
   }
 
   private static SSLTestConfig buildSSLConfig() {
-
-    if (!TEST_NIGHTLY) {
+    Class<?> targetClass = RandomizedContext.current().getTargetClass();
+    final SolrTestCase.AlwaysUseSSL alwaysUseSSL = (SolrTestCase.AlwaysUseSSL) targetClass.getAnnotation(
+        SolrTestCase.AlwaysUseSSL.class);
+    if (!TEST_NIGHTLY && alwaysUseSSL == null) {
       return new SSLTestConfig();
     }
 
     RandomizeSSL.SSLRandomizer sslRandomizer =
-            RandomizeSSL.SSLRandomizer.getSSLRandomizerForClass(RandomizedContext.current().getTargetClass());
+            RandomizeSSL.SSLRandomizer.getSSLRandomizerForClass(targetClass);
 
     if (Constants.MAC_OS_X) {
       // see SOLR-9039