dsmiley commented on code in PR #2378: URL: https://github.com/apache/solr/pull/2378#discussion_r1561775883
########## solr/core/src/test/org/apache/solr/cli/TestExportTool.java: ########## @@ -218,6 +231,66 @@ public void testVeryLargeCluster() throws Exception { } } + @Test + public void testWithBasicAuth() throws Exception { + String COLLECTION_NAME = "secureCollection"; + String USER = "solr"; + String PASS = "SolrRocksAgain"; + final String SECURITY_JSON = + Utils.toJSONString( + Map.of( + "authorization", + Map.of( + "class", + RuleBasedAuthorizationPlugin.class.getName(), + "user-role", + singletonMap(USER, "admin"), + "permissions", + singletonList(Map.of("name", "all", "role", "admin"))), + "authentication", + Map.of( + "class", + BasicAuthPlugin.class.getName(), + "blockUnknown", + true, + "credentials", + singletonMap(USER, getSaltedHashedValue(PASS))))); + + configureCluster(2) + .addConfig("conf", configset("cloud-minimal")) + .withSecurityJson(SECURITY_JSON) + .configure(); + + CloudSolrClient cloudSolrClient = cluster.getSolrClient(); + + CollectionAdminRequest.createCollection(COLLECTION_NAME, "conf", 2, 1) + .setBasicAuthCredentials(USER, PASS) + .process(cluster.getSolrClient()); + cluster.waitForActiveCollection(COLLECTION_NAME, 8, 8); Review Comment: You won't get 8 replicas anymore; you changed this. The test probably fails now. I hate `waitForActiveCollection`; the collection is already active when createCollection finishes. The risk this method mitigates is that the SolrClient returned by `cluster.getSolrClient` doesn't know it yet, but this test doesn't use the client henceforth (unlike most tests). ########## solr/core/src/test/org/apache/solr/cli/TestExportTool.java: ########## @@ -218,6 +231,66 @@ public void testVeryLargeCluster() throws Exception { } } + @Test + public void testWithBasicAuth() throws Exception { + String COLLECTION_NAME = "secureCollection"; + String USER = "solr"; + String PASS = "SolrRocksAgain"; + final String SECURITY_JSON = + Utils.toJSONString( + Map.of( + "authorization", + Map.of( + "class", + RuleBasedAuthorizationPlugin.class.getName(), + "user-role", + singletonMap(USER, "admin"), + "permissions", + singletonList(Map.of("name", "all", "role", "admin"))), + "authentication", + Map.of( + "class", + BasicAuthPlugin.class.getName(), + "blockUnknown", + true, + "credentials", + singletonMap(USER, getSaltedHashedValue(PASS))))); + + configureCluster(2) + .addConfig("conf", configset("cloud-minimal")) + .withSecurityJson(SECURITY_JSON) + .configure(); + + CloudSolrClient cloudSolrClient = cluster.getSolrClient(); + + CollectionAdminRequest.createCollection(COLLECTION_NAME, "conf", 2, 1) Review Comment: Two shards doesn't seem pertinent to what is being tested. -- 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. To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org