YARN-2692 ktutil test hanging on some machines/ktutil versions (stevel)

This commit is contained in:
Steve Loughran 2014-10-22 14:34:57 +01:00
parent 7e3b5e6f5c
commit 85a88649c3
3 changed files with 2 additions and 55 deletions

View File

@ -681,6 +681,8 @@ Release 2.6.0 - UNRELEASED
YARN-2689 TestSecureRMRegistryOperations failing on windows: YARN-2689 TestSecureRMRegistryOperations failing on windows:
secure ZK won't start (stevel) secure ZK won't start (stevel)
YARN-2692 ktutil test hanging on some machines/ktutil versions (stevel)
--- ---
YARN-2598 GHS should show N/A instead of null for the inaccessible information YARN-2598 GHS should show N/A instead of null for the inaccessible information

View File

@ -325,48 +325,6 @@ public static LoginContext logout(LoginContext login) {
return null; return null;
} }
/**
* Exec the native <code>ktutil</code> to list the keys
* (primarily to verify that the generated keytabs are compatible).
* This operation is not executed on windows. On other platforms
* it requires <code>ktutil</code> to be installed and on the path
* <pre>
* ktutil --keytab=target/kdc/zookeeper.keytab list --keys
* </pre>
* @param keytab keytab to list
* @throws IOException on any execution problem, including the executable
* being missing
*/
public static String ktList(File keytab) throws IOException {
if (!Shell.WINDOWS) {
String path = keytab.getAbsolutePath();
String out = Shell.execCommand(
KTUTIL,
"--keytab=" + path,
"list",
"--keys"
);
LOG.info("Listing of keytab {}:\n{}\n", path, out);
return out;
}
return "";
}
/**
* Perform a robust <code>ktutils -l</code> ... catches and ignores
* exceptions, otherwise the output is logged.
* @param keytab keytab to list
* @return the result of the operation, or "" on any problem
*/
public static String ktListRobust(File keytab) {
try {
return ktList(keytab);
} catch (IOException e) {
// probably not on the path
return "";
}
}
/** /**
* Login via a UGI. Requres UGI to have been set up * Login via a UGI. Requres UGI to have been set up
* @param user username * @param user username

View File

@ -56,19 +56,6 @@ public class TestSecureLogins extends AbstractSecureRegistryTest {
private static final Logger LOG = private static final Logger LOG =
LoggerFactory.getLogger(TestSecureLogins.class); LoggerFactory.getLogger(TestSecureLogins.class);
@Test
public void testZKinKeytab() throws Throwable {
Assume.assumeTrue(!Shell.WINDOWS);
try {
String listing = ktList(keytab_zk);
assertTrue("no " + ZOOKEEPER_LOCALHOST + " in " + listing,
listing.contains(ZOOKEEPER_LOCALHOST));
} catch (IOException e) {
LOG.debug(KTUTIL + " failure: {}", e, e);
Assume.assumeTrue("Failed to run "+ KTUTIL+": " + e, false );
}
}
@Test @Test
public void testHasRealm() throws Throwable { public void testHasRealm() throws Throwable {
assertNotNull(getRealm()); assertNotNull(getRealm());