From 9728dbc1675bb7fd4ca84071d40ae3c0528e424c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20H=C3=B8ydahl?= Date: Thu, 13 Dec 2018 00:14:37 +0100 Subject: [PATCH] SOLR-12791, SOLR-13067: Fix test failure for BasicAuthIntegrationTest Make PkiAuthenticationIntegrationTest beast-able --- .../solr/security/BasicAuthIntegrationTest.java | 4 ++-- .../security/PKIAuthenticationIntegrationTest.java | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java b/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java index db47d3721fa..f704cdf1ef2 100644 --- a/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java +++ b/solr/core/src/test/org/apache/solr/security/BasicAuthIntegrationTest.java @@ -254,7 +254,7 @@ public class BasicAuthIntegrationTest extends SolrCloudAuthTestCase { }); assertEquals(401, exp.code()); assertAuthMetricsMinimums(20, 8, 9, 1, 2, 0); - assertPkiAuthMetricsMinimums(4, 4, 0, 0, 0, 0); + assertPkiAuthMetricsMinimums(3, 3, 0, 0, 0, 0); // Query that succeeds GenericSolrRequest req = new GenericSolrRequest(SolrRequest.METHOD.GET, "/select", params); @@ -262,7 +262,7 @@ public class BasicAuthIntegrationTest extends SolrCloudAuthTestCase { cluster.getSolrClient().request(req, COLLECTION); assertAuthMetricsMinimums(21, 9, 9, 1, 2, 0); - assertPkiAuthMetricsMinimums(7, 7, 0, 0, 0, 0); + assertPkiAuthMetricsMinimums(6, 6, 0, 0, 0, 0); executeCommand(baseUrl + authcPrefix, cl, "{set-property : { blockUnknown: false}}", "harry", "HarryIsUberCool"); } finally { diff --git a/solr/core/src/test/org/apache/solr/security/PKIAuthenticationIntegrationTest.java b/solr/core/src/test/org/apache/solr/security/PKIAuthenticationIntegrationTest.java index aa70d053109..eb25b8306af 100644 --- a/solr/core/src/test/org/apache/solr/security/PKIAuthenticationIntegrationTest.java +++ b/solr/core/src/test/org/apache/solr/security/PKIAuthenticationIntegrationTest.java @@ -42,19 +42,21 @@ import static org.apache.solr.security.TestAuthorizationFramework.verifySecurity public class PKIAuthenticationIntegrationTest extends SolrCloudAuthTestCase { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - + private static final String COLLECTION = "pkiCollection"; + @BeforeClass public static void setupCluster() throws Exception { configureCluster(2) .addConfig("conf", configset("cloud-minimal")) .configure(); + + CollectionAdminRequest.createCollection(COLLECTION, "conf", 2, 1).process(cluster.getSolrClient()); + + cluster.waitForActiveCollection(COLLECTION, 2, 2); } @Test public void testPkiAuth() throws Exception { - - CollectionAdminRequest.createCollection("collection", "conf", 2, 1).process(cluster.getSolrClient()); - // TODO make a SolrJ helper class for this byte[] bytes = Utils.toJSON(makeMap("authorization", singletonMap("class", MockAuthorizationPlugin.class.getName()), "authentication", singletonMap("class", MockAuthenticationPlugin.class.getName()))); @@ -94,7 +96,7 @@ public class PKIAuthenticationIntegrationTest extends SolrCloudAuthTestCase { return true; }; QueryRequest query = new QueryRequest(params); - query.process(cluster.getSolrClient(), "collection"); + query.process(cluster.getSolrClient(), COLLECTION); assertTrue("all nodes must get the user solr , no:of nodes got solr : " + count.get(), count.get() > 2); assertPkiAuthMetricsMinimums(2, 2, 0, 0, 0, 0); }