Credential Provider related Unit Test Failure on Windows. Contributed by Xiaoyu Yao.
This commit is contained in:
parent
0974f434c4
commit
302d9a0a0d
@ -768,6 +768,9 @@ Release 2.6.0 - UNRELEASED
|
||||
HADOOP-11069. KMSClientProvider should use getAuthenticationMethod() to
|
||||
determine if in proxyuser mode or not. (tucu)
|
||||
|
||||
HADOOP-11073. Credential Provider related Unit Tests Failure on Windows.
|
||||
(Xiaoyu Yao via cnauroth)
|
||||
|
||||
Release 2.5.1 - UNRELEASED
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
@ -55,18 +55,18 @@ public void setup() {
|
||||
@Test
|
||||
public void testFactory() throws Exception {
|
||||
Configuration conf = new Configuration();
|
||||
final String userUri = UserProvider.SCHEME_NAME + ":///";
|
||||
final Path jksPath = new Path(tmpDir.toString(), "test.jks");
|
||||
final String jksUri = JavaKeyStoreProvider.SCHEME_NAME +
|
||||
"://file" + jksPath.toUri().toString();
|
||||
conf.set(KeyProviderFactory.KEY_PROVIDER_PATH,
|
||||
UserProvider.SCHEME_NAME + ":///," +
|
||||
JavaKeyStoreProvider.SCHEME_NAME + "://file" + tmpDir + "/test.jks");
|
||||
userUri + "," + jksUri);
|
||||
List<KeyProvider> providers = KeyProviderFactory.getProviders(conf);
|
||||
assertEquals(2, providers.size());
|
||||
assertEquals(UserProvider.class, providers.get(0).getClass());
|
||||
assertEquals(JavaKeyStoreProvider.class, providers.get(1).getClass());
|
||||
assertEquals(UserProvider.SCHEME_NAME +
|
||||
":///", providers.get(0).toString());
|
||||
assertEquals(JavaKeyStoreProvider.SCHEME_NAME +
|
||||
"://file" + tmpDir + "/test.jks",
|
||||
providers.get(1).toString());
|
||||
assertEquals(userUri, providers.get(0).toString());
|
||||
assertEquals(jksUri, providers.get(1).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -207,8 +207,9 @@ public void testUserProvider() throws Exception {
|
||||
@Test
|
||||
public void testJksProvider() throws Exception {
|
||||
Configuration conf = new Configuration();
|
||||
final Path jksPath = new Path(tmpDir.toString(), "test.jks");
|
||||
final String ourUrl =
|
||||
JavaKeyStoreProvider.SCHEME_NAME + "://file" + tmpDir + "/test.jks";
|
||||
JavaKeyStoreProvider.SCHEME_NAME + "://file" + jksPath.toUri();
|
||||
|
||||
File file = new File(tmpDir, "test.jks");
|
||||
file.delete();
|
||||
@ -317,8 +318,9 @@ public void checkPermissionRetention(Configuration conf, String ourUrl, Path pat
|
||||
@Test
|
||||
public void testJksProviderPasswordViaConfig() throws Exception {
|
||||
Configuration conf = new Configuration();
|
||||
final Path jksPath = new Path(tmpDir.toString(), "test.jks");
|
||||
final String ourUrl =
|
||||
JavaKeyStoreProvider.SCHEME_NAME + "://file" + tmpDir + "/test.jks";
|
||||
JavaKeyStoreProvider.SCHEME_NAME + "://file" + jksPath.toUri();
|
||||
File file = new File(tmpDir, "test.jks");
|
||||
file.delete();
|
||||
try {
|
||||
@ -360,8 +362,8 @@ public void testJksProviderPasswordViaConfig() throws Exception {
|
||||
@Test
|
||||
public void testGetProviderViaURI() throws Exception {
|
||||
Configuration conf = new Configuration(false);
|
||||
URI uri = new URI(JavaKeyStoreProvider.SCHEME_NAME + "://file" + tmpDir +
|
||||
"/test.jks");
|
||||
final Path jksPath = new Path(tmpDir.toString(), "test.jks");
|
||||
URI uri = new URI(JavaKeyStoreProvider.SCHEME_NAME + "://file" + jksPath.toUri());
|
||||
KeyProvider kp = KeyProviderFactory.get(uri, conf);
|
||||
Assert.assertNotNull(kp);
|
||||
Assert.assertEquals(JavaKeyStoreProvider.class, kp.getClass());
|
||||
|
@ -40,6 +40,7 @@
|
||||
import javax.naming.directory.SearchResult;
|
||||
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.fs.Path;
|
||||
import org.apache.hadoop.security.alias.CredentialProvider;
|
||||
import org.apache.hadoop.security.alias.CredentialProviderFactory;
|
||||
import org.apache.hadoop.security.alias.JavaKeyStoreProvider;
|
||||
@ -165,8 +166,9 @@ public void testConfGetPassword() throws Exception {
|
||||
File testDir = new File(System.getProperty("test.build.data",
|
||||
"target/test-dir"));
|
||||
Configuration conf = new Configuration();
|
||||
final Path jksPath = new Path(testDir.toString(), "test.jks");
|
||||
final String ourUrl =
|
||||
JavaKeyStoreProvider.SCHEME_NAME + "://file/" + testDir + "/test.jks";
|
||||
JavaKeyStoreProvider.SCHEME_NAME + "://file" + jksPath.toUri();
|
||||
|
||||
File file = new File(testDir, "test.jks");
|
||||
file.delete();
|
||||
|
@ -52,19 +52,19 @@ public class TestCredentialProviderFactory {
|
||||
@Test
|
||||
public void testFactory() throws Exception {
|
||||
Configuration conf = new Configuration();
|
||||
final String userUri = UserProvider.SCHEME_NAME + ":///";
|
||||
final Path jksPath = new Path(tmpDir.toString(), "test.jks");
|
||||
final String jksUri = JavaKeyStoreProvider.SCHEME_NAME +
|
||||
"://file" + jksPath.toUri();
|
||||
conf.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH,
|
||||
UserProvider.SCHEME_NAME + ":///," +
|
||||
JavaKeyStoreProvider.SCHEME_NAME + "://file" + tmpDir + "/test.jks");
|
||||
userUri + "," + jksUri);
|
||||
List<CredentialProvider> providers =
|
||||
CredentialProviderFactory.getProviders(conf);
|
||||
assertEquals(2, providers.size());
|
||||
assertEquals(UserProvider.class, providers.get(0).getClass());
|
||||
assertEquals(JavaKeyStoreProvider.class, providers.get(1).getClass());
|
||||
assertEquals(UserProvider.SCHEME_NAME +
|
||||
":///", providers.get(0).toString());
|
||||
assertEquals(JavaKeyStoreProvider.SCHEME_NAME +
|
||||
"://file" + tmpDir + "/test.jks",
|
||||
providers.get(1).toString());
|
||||
assertEquals(userUri, providers.get(0).toString());
|
||||
assertEquals(jksUri, providers.get(1).toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -188,8 +188,9 @@ public void testUserProvider() throws Exception {
|
||||
@Test
|
||||
public void testJksProvider() throws Exception {
|
||||
Configuration conf = new Configuration();
|
||||
final Path jksPath = new Path(tmpDir.toString(), "test.jks");
|
||||
final String ourUrl =
|
||||
JavaKeyStoreProvider.SCHEME_NAME + "://file" + tmpDir + "/test.jks";
|
||||
JavaKeyStoreProvider.SCHEME_NAME + "://file" + jksPath.toUri();
|
||||
|
||||
File file = new File(tmpDir, "test.jks");
|
||||
file.delete();
|
||||
|
@ -19,6 +19,7 @@
|
||||
package org.apache.hadoop.security.ssl;
|
||||
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.fs.Path;
|
||||
import org.apache.hadoop.security.alias.CredentialProvider;
|
||||
import org.apache.hadoop.security.alias.CredentialProviderFactory;
|
||||
import org.apache.hadoop.security.alias.JavaKeyStoreProvider;
|
||||
@ -392,8 +393,9 @@ public static void provisionPasswordsToCredentialProvider() throws Exception {
|
||||
"target/test-dir"));
|
||||
|
||||
Configuration conf = new Configuration();
|
||||
final Path jksPath = new Path(testDir.toString(), "test.jks");
|
||||
final String ourUrl =
|
||||
JavaKeyStoreProvider.SCHEME_NAME + "://file/" + testDir + "/test.jks";
|
||||
JavaKeyStoreProvider.SCHEME_NAME + "://file" + jksPath.toUri();
|
||||
|
||||
File file = new File(testDir, "test.jks");
|
||||
file.delete();
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
import org.apache.hadoop.fs.FileUtil;
|
||||
import org.apache.hadoop.fs.Path;
|
||||
import org.apache.hadoop.security.alias.CredentialProvider;
|
||||
import org.apache.hadoop.security.alias.CredentialProviderFactory;
|
||||
import org.apache.hadoop.security.alias.JavaKeyStoreProvider;
|
||||
@ -305,8 +306,9 @@ private void checkSSLFactoryInitWithPasswords(SSLFactory.Mode mode,
|
||||
if (useCredProvider) {
|
||||
File testDir = new File(System.getProperty("test.build.data",
|
||||
"target/test-dir"));
|
||||
final Path jksPath = new Path(testDir.toString(), "test.jks");
|
||||
final String ourUrl =
|
||||
JavaKeyStoreProvider.SCHEME_NAME + "://file/" + testDir + "/test.jks";
|
||||
JavaKeyStoreProvider.SCHEME_NAME + "://file" + jksPath.toUri();
|
||||
sslConf.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH, ourUrl);
|
||||
}
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user