YARN-2700 TestSecureRMRegistryOperations failing on windows: auth problems
This commit is contained in:
parent
d67214fd69
commit
90e5ca24fb
|
@ -683,6 +683,9 @@ Release 2.6.0 - UNRELEASED
|
||||||
|
|
||||||
YARN-2692 ktutil test hanging on some machines/ktutil versions (stevel)
|
YARN-2692 ktutil test hanging on some machines/ktutil versions (stevel)
|
||||||
|
|
||||||
|
YARN-2700 TestSecureRMRegistryOperations failing on windows: auth problems
|
||||||
|
(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
|
||||||
|
|
|
@ -31,6 +31,7 @@ import org.apache.hadoop.registry.client.impl.zk.ZookeeperConfigOptions;
|
||||||
import org.apache.hadoop.registry.server.services.AddingCompositeService;
|
import org.apache.hadoop.registry.server.services.AddingCompositeService;
|
||||||
import org.apache.hadoop.registry.server.services.MicroZookeeperService;
|
import org.apache.hadoop.registry.server.services.MicroZookeeperService;
|
||||||
import org.apache.hadoop.registry.server.services.MicroZookeeperServiceKeys;
|
import org.apache.hadoop.registry.server.services.MicroZookeeperServiceKeys;
|
||||||
|
import org.apache.hadoop.util.Shell;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
@ -61,6 +62,7 @@ public class AbstractSecureRegistryTest extends RegistryTestHelper {
|
||||||
public static final String REALM = "EXAMPLE.COM";
|
public static final String REALM = "EXAMPLE.COM";
|
||||||
public static final String ZOOKEEPER = "zookeeper";
|
public static final String ZOOKEEPER = "zookeeper";
|
||||||
public static final String ZOOKEEPER_LOCALHOST = "zookeeper/localhost";
|
public static final String ZOOKEEPER_LOCALHOST = "zookeeper/localhost";
|
||||||
|
public static final String ZOOKEEPER_1270001 = "zookeeper/127.0.0.1";
|
||||||
public static final String ZOOKEEPER_REALM = "zookeeper@" + REALM;
|
public static final String ZOOKEEPER_REALM = "zookeeper@" + REALM;
|
||||||
public static final String ZOOKEEPER_CLIENT_CONTEXT = ZOOKEEPER;
|
public static final String ZOOKEEPER_CLIENT_CONTEXT = ZOOKEEPER;
|
||||||
public static final String ZOOKEEPER_SERVER_CONTEXT = "ZOOKEEPER_SERVER";
|
public static final String ZOOKEEPER_SERVER_CONTEXT = "ZOOKEEPER_SERVER";
|
||||||
|
@ -118,6 +120,7 @@ public class AbstractSecureRegistryTest extends RegistryTestHelper {
|
||||||
protected MicroZookeeperService secureZK;
|
protected MicroZookeeperService secureZK;
|
||||||
protected static File jaasFile;
|
protected static File jaasFile;
|
||||||
private LoginContext zookeeperLogin;
|
private LoginContext zookeeperLogin;
|
||||||
|
private static String zkServerPrincipal;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All class initialization for this test class
|
* All class initialization for this test class
|
||||||
|
@ -203,12 +206,13 @@ public class AbstractSecureRegistryTest extends RegistryTestHelper {
|
||||||
keytab_zk = createKeytab(ZOOKEEPER, "zookeeper.keytab");
|
keytab_zk = createKeytab(ZOOKEEPER, "zookeeper.keytab");
|
||||||
keytab_alice = createKeytab(ALICE, "alice.keytab");
|
keytab_alice = createKeytab(ALICE, "alice.keytab");
|
||||||
keytab_bob = createKeytab(BOB, "bob.keytab");
|
keytab_bob = createKeytab(BOB, "bob.keytab");
|
||||||
|
zkServerPrincipal = Shell.WINDOWS ? ZOOKEEPER_1270001 : ZOOKEEPER_LOCALHOST;
|
||||||
|
|
||||||
StringBuilder jaas = new StringBuilder(1024);
|
StringBuilder jaas = new StringBuilder(1024);
|
||||||
jaas.append(registrySecurity.createJAASEntry(ZOOKEEPER_CLIENT_CONTEXT,
|
jaas.append(registrySecurity.createJAASEntry(ZOOKEEPER_CLIENT_CONTEXT,
|
||||||
ZOOKEEPER, keytab_zk));
|
ZOOKEEPER, keytab_zk));
|
||||||
jaas.append(registrySecurity.createJAASEntry(ZOOKEEPER_SERVER_CONTEXT,
|
jaas.append(registrySecurity.createJAASEntry(ZOOKEEPER_SERVER_CONTEXT,
|
||||||
ZOOKEEPER_LOCALHOST, keytab_zk));
|
zkServerPrincipal, keytab_zk));
|
||||||
jaas.append(registrySecurity.createJAASEntry(ALICE_CLIENT_CONTEXT,
|
jaas.append(registrySecurity.createJAASEntry(ALICE_CLIENT_CONTEXT,
|
||||||
ALICE_LOCALHOST , keytab_alice));
|
ALICE_LOCALHOST , keytab_alice));
|
||||||
jaas.append(registrySecurity.createJAASEntry(BOB_CLIENT_CONTEXT,
|
jaas.append(registrySecurity.createJAASEntry(BOB_CLIENT_CONTEXT,
|
||||||
|
@ -300,7 +304,10 @@ public class AbstractSecureRegistryTest extends RegistryTestHelper {
|
||||||
assertNotEmpty("empty host", filename);
|
assertNotEmpty("empty host", filename);
|
||||||
assertNotNull("Null KDC", kdc);
|
assertNotNull("Null KDC", kdc);
|
||||||
File keytab = new File(kdcWorkDir, filename);
|
File keytab = new File(kdcWorkDir, filename);
|
||||||
kdc.createPrincipal(keytab, principal, principal +"/localhost");
|
kdc.createPrincipal(keytab,
|
||||||
|
principal,
|
||||||
|
principal + "/localhost",
|
||||||
|
principal + "/127.0.0.1");
|
||||||
return keytab;
|
return keytab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,12 +358,11 @@ public class AbstractSecureRegistryTest extends RegistryTestHelper {
|
||||||
protected synchronized void startSecureZK() throws Exception {
|
protected synchronized void startSecureZK() throws Exception {
|
||||||
assertNull("Zookeeper is already running", secureZK);
|
assertNull("Zookeeper is already running", secureZK);
|
||||||
|
|
||||||
zookeeperLogin = login(ZOOKEEPER_LOCALHOST,
|
zookeeperLogin = login(zkServerPrincipal,
|
||||||
ZOOKEEPER_SERVER_CONTEXT,
|
ZOOKEEPER_SERVER_CONTEXT,
|
||||||
keytab_zk);
|
keytab_zk);
|
||||||
secureZK = createSecureZKInstance("test-" + methodName.getMethodName());
|
secureZK = createSecureZKInstance("test-" + methodName.getMethodName());
|
||||||
secureZK.start();
|
secureZK.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue