Skip to content

Apache Lucene open-source search software

SOLR-9460: Fully fix test setup

Uwe Schindlere026ac4fe5d1
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithSecureImpersonation.java b/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithSecureImpersonation.java
index 37276201967..ef41e4d315a 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithSecureImpersonation.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestSolrCloudWithSecureImpersonation.java
@@ -58,16 +58,18 @@ public class TestSolrCloudWithSecureImpersonation extends SolrTestCaseJ4 {
private static SolrClient solrClient;
private static String getUsersFirstGroup() throws Exception {
- org.apache.hadoop.security.Groups hGroups =
- new org.apache.hadoop.security.Groups(new Configuration());
String group = "*"; // accept any group if a group can't be found
- try {
- List<String> g = hGroups.getGroups(System.getProperty("user.name"));
- if (g != null && g.size() > 0) {
- group = g.get(0);
+ if (!Constants.WINDOWS) { // does not work on Windows!
+ org.apache.hadoop.security.Groups hGroups =
+ new org.apache.hadoop.security.Groups(new Configuration());
+ try {
+ List<String> g = hGroups.getGroups(System.getProperty("user.name"));
+ if (g != null && g.size() > 0) {
+ group = g.get(0);
+ }
+ } catch (NullPointerException npe) {
+ // if user/group doesn't exist on test box
}
- } catch (NullPointerException npe) {
- // if user/group doesn't exist on test box
}
return group;
}
@@ -154,7 +156,9 @@ public class TestSolrCloudWithSecureImpersonation extends SolrTestCaseJ4 {
miniCluster.shutdown();
}
miniCluster = null;
- solrClient.close();
+ if (solrClient != null) {
+ solrClient.close();
+ }
solrClient = null;
System.clearProperty("authenticationPlugin");
System.clearProperty(KerberosPlugin.DELEGATION_TOKEN_ENABLED);