HADOOP-11312. Fix unit tests to not use uppercase key names.

This commit is contained in:
Andrew Wang 2014-11-18 10:47:46 -08:00
parent b4ca727690
commit bcd402ae38
6 changed files with 29 additions and 25 deletions

View File

@ -450,6 +450,8 @@ Release 2.7.0 - UNRELEASED
HADOOP-11309. System class pattern package.Foo should match HADOOP-11309. System class pattern package.Foo should match
package.Foo$Bar, too (Gera Shegalov via jlowe) package.Foo$Bar, too (Gera Shegalov via jlowe)
HADOOP-11312. Fix unit tests to not use uppercase key names. (wang)
Release 2.6.0 - 2014-11-18 Release 2.6.0 - 2014-11-18
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -1522,8 +1522,10 @@ public void testDelegationTokenAccess() throws Exception {
conf.set("hadoop.kms.authentication.kerberos.principal", "HTTP/localhost"); conf.set("hadoop.kms.authentication.kerberos.principal", "HTTP/localhost");
conf.set("hadoop.kms.authentication.kerberos.name.rules", "DEFAULT"); conf.set("hadoop.kms.authentication.kerberos.name.rules", "DEFAULT");
conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kA.ALL", "*"); final String keyA = "key_a";
conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kD.ALL", "*"); final String keyD = "key_d";
conf.set(KeyAuthorizationKeyProvider.KEY_ACL + keyA + ".ALL", "*");
conf.set(KeyAuthorizationKeyProvider.KEY_ACL + keyD + ".ALL", "*");
writeConf(testDir, conf); writeConf(testDir, conf);
@ -1539,7 +1541,7 @@ public Void call() throws Exception {
try { try {
KeyProvider kp = new KMSClientProvider(uri, conf); KeyProvider kp = new KMSClientProvider(uri, conf);
kp.createKey("kA", new KeyProvider.Options(conf)); kp.createKey(keyA, new KeyProvider.Options(conf));
} catch (IOException ex) { } catch (IOException ex) {
System.out.println(ex.getMessage()); System.out.println(ex.getMessage());
} }
@ -1560,7 +1562,7 @@ public Void run() throws Exception {
try { try {
KeyProvider kp = new KMSClientProvider(uri, conf); KeyProvider kp = new KMSClientProvider(uri, conf);
kp.createKey("kA", new KeyProvider.Options(conf)); kp.createKey(keyA, new KeyProvider.Options(conf));
} catch (IOException ex) { } catch (IOException ex) {
System.out.println(ex.getMessage()); System.out.println(ex.getMessage());
} }
@ -1569,7 +1571,7 @@ public Void run() throws Exception {
@Override @Override
public Void run() throws Exception { public Void run() throws Exception {
KeyProvider kp = new KMSClientProvider(uri, conf); KeyProvider kp = new KMSClientProvider(uri, conf);
kp.createKey("kD", new KeyProvider.Options(conf)); kp.createKey(keyD, new KeyProvider.Options(conf));
return null; return null;
} }
}); });
@ -1704,10 +1706,10 @@ public void doProxyUserTest(final boolean kerberos) throws Exception {
conf.set("hadoop.kms.authentication.kerberos.name.rules", "DEFAULT"); conf.set("hadoop.kms.authentication.kerberos.name.rules", "DEFAULT");
conf.set("hadoop.kms.proxyuser.client.users", "foo,bar"); conf.set("hadoop.kms.proxyuser.client.users", "foo,bar");
conf.set("hadoop.kms.proxyuser.client.hosts", "*"); conf.set("hadoop.kms.proxyuser.client.hosts", "*");
conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kAA.ALL", "client"); conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kaa.ALL", "client");
conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kBB.ALL", "foo"); conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kbb.ALL", "foo");
conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kCC.ALL", "foo1"); conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kcc.ALL", "foo1");
conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kDD.ALL", "bar"); conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kdd.ALL", "bar");
writeConf(testDir, conf); writeConf(testDir, conf);
@ -1732,7 +1734,7 @@ public Void call() throws Exception {
@Override @Override
public Void run() throws Exception { public Void run() throws Exception {
final KeyProvider kp = new KMSClientProvider(uri, conf); final KeyProvider kp = new KMSClientProvider(uri, conf);
kp.createKey("kAA", new KeyProvider.Options(conf)); kp.createKey("kaa", new KeyProvider.Options(conf));
// authorized proxyuser // authorized proxyuser
UserGroupInformation fooUgi = UserGroupInformation fooUgi =
@ -1740,7 +1742,7 @@ public Void run() throws Exception {
fooUgi.doAs(new PrivilegedExceptionAction<Void>() { fooUgi.doAs(new PrivilegedExceptionAction<Void>() {
@Override @Override
public Void run() throws Exception { public Void run() throws Exception {
Assert.assertNotNull(kp.createKey("kBB", Assert.assertNotNull(kp.createKey("kbb",
new KeyProvider.Options(conf))); new KeyProvider.Options(conf)));
return null; return null;
} }
@ -1753,7 +1755,7 @@ public Void run() throws Exception {
@Override @Override
public Void run() throws Exception { public Void run() throws Exception {
try { try {
kp.createKey("kCC", new KeyProvider.Options(conf)); kp.createKey("kcc", new KeyProvider.Options(conf));
Assert.fail(); Assert.fail();
} catch (AuthorizationException ex) { } catch (AuthorizationException ex) {
// OK // OK
@ -1770,7 +1772,7 @@ public Void run() throws Exception {
barUgi.doAs(new PrivilegedExceptionAction<Void>() { barUgi.doAs(new PrivilegedExceptionAction<Void>() {
@Override @Override
public Void run() throws Exception { public Void run() throws Exception {
Assert.assertNotNull(kp.createKey("kDD", Assert.assertNotNull(kp.createKey("kdd",
new KeyProvider.Options(conf))); new KeyProvider.Options(conf)));
return null; return null;
} }
@ -1810,9 +1812,9 @@ public void doWebHDFSProxyUserTest(final boolean kerberos) throws Exception {
conf.set("hadoop.security.kms.client.timeout", "300"); conf.set("hadoop.security.kms.client.timeout", "300");
conf.set("hadoop.kms.proxyuser.client.users", "foo,bar"); conf.set("hadoop.kms.proxyuser.client.users", "foo,bar");
conf.set("hadoop.kms.proxyuser.client.hosts", "*"); conf.set("hadoop.kms.proxyuser.client.hosts", "*");
conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kAA.ALL", "foo"); conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kaa.ALL", "foo");
conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kBB.ALL", "foo1"); conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kbb.ALL", "foo1");
conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kCC.ALL", "bar"); conf.set(KeyAuthorizationKeyProvider.KEY_ACL + "kcc.ALL", "bar");
writeConf(testDir, conf); writeConf(testDir, conf);
@ -1844,7 +1846,7 @@ public Void run() throws Exception {
@Override @Override
public Void run() throws Exception { public Void run() throws Exception {
KeyProvider kp = new KMSClientProvider(uri, conf); KeyProvider kp = new KMSClientProvider(uri, conf);
Assert.assertNotNull(kp.createKey("kAA", Assert.assertNotNull(kp.createKey("kaa",
new KeyProvider.Options(conf))); new KeyProvider.Options(conf)));
return null; return null;
} }
@ -1858,7 +1860,7 @@ public Void run() throws Exception {
public Void run() throws Exception { public Void run() throws Exception {
try { try {
KeyProvider kp = new KMSClientProvider(uri, conf); KeyProvider kp = new KMSClientProvider(uri, conf);
kp.createKey("kBB", new KeyProvider.Options(conf)); kp.createKey("kbb", new KeyProvider.Options(conf));
Assert.fail(); Assert.fail();
} catch (Exception ex) { } catch (Exception ex) {
Assert.assertTrue(ex.getMessage(), ex.getMessage().contains("Forbidden")); Assert.assertTrue(ex.getMessage(), ex.getMessage().contains("Forbidden"));
@ -1874,7 +1876,7 @@ public Void run() throws Exception {
@Override @Override
public Void run() throws Exception { public Void run() throws Exception {
KeyProvider kp = new KMSClientProvider(uri, conf); KeyProvider kp = new KMSClientProvider(uri, conf);
Assert.assertNotNull(kp.createKey("kCC", Assert.assertNotNull(kp.createKey("kcc",
new KeyProvider.Options(conf))); new KeyProvider.Options(conf)));
return null; return null;
} }

View File

@ -115,7 +115,7 @@ public class TestRpcProgramNfs3 {
static SecurityHandler securityHandler; static SecurityHandler securityHandler;
static SecurityHandler securityHandlerUnpriviledged; static SecurityHandler securityHandlerUnpriviledged;
static String testdir = "/tmp"; static String testdir = "/tmp";
private static final String TEST_KEY = "testKey"; private static final String TEST_KEY = "test_key";
private static FileSystemTestHelper fsHelper; private static FileSystemTestHelper fsHelper;
private static File testRootDir; private static File testRootDir;

View File

@ -120,7 +120,7 @@ public class TestEncryptionZones {
protected HdfsAdmin dfsAdmin; protected HdfsAdmin dfsAdmin;
protected DistributedFileSystem fs; protected DistributedFileSystem fs;
private File testRootDir; private File testRootDir;
protected final String TEST_KEY = "testKey"; protected final String TEST_KEY = "test_key";
protected FileSystemTestWrapper fsWrapper; protected FileSystemTestWrapper fsWrapper;
protected FileContextTestWrapper fcWrapper; protected FileContextTestWrapper fcWrapper;
@ -985,7 +985,7 @@ public void doCleanup() throws Exception {
// Test when the parent directory becomes a different EZ // Test when the parent directory becomes a different EZ
fsWrapper.mkdir(zone1, FsPermission.getDirDefault(), true); fsWrapper.mkdir(zone1, FsPermission.getDirDefault(), true);
final String otherKey = "otherKey"; final String otherKey = "other_key";
DFSTestUtil.createKey(otherKey, cluster, conf); DFSTestUtil.createKey(otherKey, cluster, conf);
dfsAdmin.createEncryptionZone(zone1, TEST_KEY); dfsAdmin.createEncryptionZone(zone1, TEST_KEY);
@ -1005,7 +1005,7 @@ public void doCleanup() throws Exception {
// Test that the retry limit leads to an error // Test that the retry limit leads to an error
fsWrapper.mkdir(zone1, FsPermission.getDirDefault(), true); fsWrapper.mkdir(zone1, FsPermission.getDirDefault(), true);
final String anotherKey = "anotherKey"; final String anotherKey = "another_key";
DFSTestUtil.createKey(anotherKey, cluster, conf); DFSTestUtil.createKey(anotherKey, cluster, conf);
dfsAdmin.createEncryptionZone(zone1, anotherKey); dfsAdmin.createEncryptionZone(zone1, anotherKey);
String keyToUse = otherKey; String keyToUse = otherKey;

View File

@ -48,7 +48,7 @@ public class TestEncryptionZonesWithHA {
private FileSystemTestHelper fsHelper; private FileSystemTestHelper fsHelper;
private File testRootDir; private File testRootDir;
private final String TEST_KEY = "testKey"; private final String TEST_KEY = "test_key";
@Before @Before

View File

@ -56,7 +56,7 @@ public class TestReservedRawPaths {
private MiniDFSCluster cluster; private MiniDFSCluster cluster;
private HdfsAdmin dfsAdmin; private HdfsAdmin dfsAdmin;
private DistributedFileSystem fs; private DistributedFileSystem fs;
private final String TEST_KEY = "testKey"; private final String TEST_KEY = "test_key";
protected FileSystemTestWrapper fsWrapper; protected FileSystemTestWrapper fsWrapper;
protected FileContextTestWrapper fcWrapper; protected FileContextTestWrapper fcWrapper;