def test_create_hdfs_dir(self, create_dir_hadoop2): eng = edp_engine.EdpOozieEngine(get_cluster()) remote = mock.Mock() dir_name = mock.Mock() eng.create_hdfs_dir(remote, dir_name) create_dir_hadoop2.assert_called_once_with(remote, dir_name, eng.get_hdfs_user())
def test_validate_job_execution(self, c): cluster = get_cluster() eng = edp_engine.EdpOozieEngine(cluster) eng.validate_job_execution(cluster, mock.Mock(), mock.Mock()) # more than one oozie server dict.__setitem__(cluster.node_groups[1], 'count', 2) self.assertRaises(pl_ex.InvalidComponentCountException, eng.validate_job_execution, cluster, mock.Mock(), mock.Mock())
def test_get_oozie_server(self): cluster = get_cluster() eng = edp_engine.EdpOozieEngine(cluster) actual = eng.get_oozie_server(cluster) expect = cluster.node_groups[1].instances[0] self.assertEqual(expect, actual)
def test_get_resource_manager_uri(self): cluster = get_cluster() eng = edp_engine.EdpOozieEngine(cluster) uri = eng.get_resource_manager_uri(cluster) self.assertEqual("master_inst.novalocal:8032", uri)
def test_get_name_node_uri(self): cluster = get_cluster() eng = edp_engine.EdpOozieEngine(cluster) uri = eng.get_name_node_uri(cluster) self.assertEqual("hdfs://master_inst.novalocal:8020", uri)
def test_get_oozie_server_uri(self): cluster = get_cluster() eng = edp_engine.EdpOozieEngine(cluster) uri = eng.get_oozie_server_uri(cluster) self.assertEqual("http://1.2.3.5:11000/oozie", uri)
def test_get_hdfs_user(self): eng = edp_engine.EdpOozieEngine(get_cluster()) self.assertEqual('hdfs', eng.get_hdfs_user())
def get_edp_engine(self, cluster, job_type): if job_type in edp_engine.EdpOozieEngine.get_supported_job_types(): return edp_engine.EdpOozieEngine(cluster) return None