public virtual void SetupCluster() { conf = new Configuration(); conf.SetInt(DFSConfigKeys.DfsHaTaileditsPeriodKey, 1); HAUtil.SetAllowStandbyReads(conf, true); fsHelper = new FileSystemTestHelper(); string testRoot = fsHelper.GetTestRootDir(); testRootDir = new FilePath(testRoot).GetAbsoluteFile(); conf.Set(DFSConfigKeys.DfsEncryptionKeyProviderUri, JavaKeyStoreProvider.SchemeName + "://file" + new Path(testRootDir.ToString(), "test.jks").ToUri()); cluster = new MiniDFSCluster.Builder(conf).NnTopology(MiniDFSNNTopology.SimpleHATopology ()).NumDataNodes(1).Build(); cluster.WaitActive(); cluster.TransitionToActive(0); fs = (DistributedFileSystem)HATestUtil.ConfigureFailoverFs(cluster, conf); DFSTestUtil.CreateKey(TestKey, cluster, 0, conf); DFSTestUtil.CreateKey(TestKey, cluster, 1, conf); nn0 = cluster.GetNameNode(0); nn1 = cluster.GetNameNode(1); dfsAdmin0 = new HdfsAdmin(cluster.GetURI(0), conf); dfsAdmin1 = new HdfsAdmin(cluster.GetURI(1), conf); KeyProviderCryptoExtension nn0Provider = cluster.GetNameNode(0).GetNamesystem().GetProvider (); fs.GetClient().SetKeyProvider(nn0Provider); }
public virtual void Setup() { fsHelper = new FileSystemTestHelper(); string testRoot = fsHelper.GetTestRootDir(); testRootDir = new FilePath(testRoot).GetAbsoluteFile(); }
public static void Setup() { string currentUser = Runtime.GetProperty("user.name"); config.Set("fs.permissions.umask-mode", "u=rwx,g=,o="); config.Set(DefaultImpersonationProvider.GetTestProvider().GetProxySuperuserGroupConfKey (currentUser), "*"); config.Set(DefaultImpersonationProvider.GetTestProvider().GetProxySuperuserIpConfKey (currentUser), "*"); fsHelper = new FileSystemTestHelper(); // Set up java key store string testRoot = fsHelper.GetTestRootDir(); testRootDir = new FilePath(testRoot).GetAbsoluteFile(); Path jksPath = new Path(testRootDir.ToString(), "test.jks"); config.Set(DFSConfigKeys.DfsEncryptionKeyProviderUri, JavaKeyStoreProvider.SchemeName + "://file" + jksPath.ToUri()); ProxyUsers.RefreshSuperUserGroupsConfiguration(config); cluster = new MiniDFSCluster.Builder(config).NumDataNodes(1).Build(); cluster.WaitActive(); hdfs = cluster.GetFileSystem(); nn = cluster.GetNameNode(); dfsAdmin = new HdfsAdmin(cluster.GetURI(), config); // Use ephemeral ports in case tests are running in parallel config.SetInt("nfs3.mountd.port", 0); config.SetInt("nfs3.server.port", 0); // Start NFS with allowed.hosts set to "* rw" config.Set("dfs.nfs.exports.allowed.hosts", "* rw"); nfs = new Org.Apache.Hadoop.Hdfs.Nfs.Nfs3.Nfs3(config); nfs.StartServiceInternal(false); nfsd = (RpcProgramNfs3)nfs.GetRpcProgram(); hdfs.GetClient().SetKeyProvider(nn.GetNamesystem().GetProvider()); DFSTestUtil.CreateKey(TestKey, cluster, config); // Mock SecurityHandler which returns system user.name securityHandler = Org.Mockito.Mockito.Mock <SecurityHandler>(); Org.Mockito.Mockito.When(securityHandler.GetUser()).ThenReturn(currentUser); // Mock SecurityHandler which returns a dummy username "harry" securityHandlerUnpriviledged = Org.Mockito.Mockito.Mock <SecurityHandler>(); Org.Mockito.Mockito.When(securityHandlerUnpriviledged.GetUser()).ThenReturn("harry" ); }
public virtual void Setup() { conf = new HdfsConfiguration(); fsHelper = new FileSystemTestHelper(); // Set up java key store string testRoot = fsHelper.GetTestRootDir(); FilePath testRootDir = new FilePath(testRoot).GetAbsoluteFile(); Path jksPath = new Path(testRootDir.ToString(), "test.jks"); conf.Set(DFSConfigKeys.DfsEncryptionKeyProviderUri, JavaKeyStoreProvider.SchemeName + "://file" + jksPath.ToUri()); cluster = new MiniDFSCluster.Builder(conf).NumDataNodes(1).Build(); Logger.GetLogger(typeof(EncryptionZoneManager)).SetLevel(Level.Trace); fs = cluster.GetFileSystem(); fsWrapper = new FileSystemTestWrapper(cluster.GetFileSystem()); fcWrapper = new FileContextTestWrapper(FileContext.GetFileContext(cluster.GetURI( ), conf)); dfsAdmin = new HdfsAdmin(cluster.GetURI(), conf); // Need to set the client's KeyProvider to the NN's for JKS, // else the updates do not get flushed properly fs.GetClient().SetKeyProvider(cluster.GetNameNode().GetNamesystem().GetProvider() ); DFSTestUtil.CreateKey(TestKey, cluster, conf); }