SOLR-9460: Fully fix test setup

This commit is contained in:
Uwe Schindler 2016-09-03 20:30:30 +02:00 committed by yonik
parent 225198a2b7
commit 6428772aa2
1 changed files with 13 additions and 9 deletions

View File

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