add unit test for test_hdfs_helper
Change-Id: I4743d189229b59e8998d093370cd5d0eb51afe13
This commit is contained in:
parent
9cf5fc45c0
commit
34dcbd6e59
@ -132,3 +132,14 @@ class HDFSHelperTestCase(base.SaharaTestCase):
|
||||
mock.call().__enter__().write_file_to(str1, mock_helper()),
|
||||
mock.call().__enter__().execute_command(str2, run_as_root=True),
|
||||
mock.call().__exit__(None, None, None)])
|
||||
|
||||
@mock.patch('six.text_type')
|
||||
@mock.patch('os.open')
|
||||
def test_put_file_to_hdfs(self, open_get, mock_six):
|
||||
open_get.return_value = '/tmp/workflow.xml'
|
||||
mock_six.return_value = 111
|
||||
helper.put_file_to_hdfs(self.cluster, open_get, 'workflow',
|
||||
'/tmp', 'hdfs')
|
||||
self.cluster.execute_command.assert_called_once_with(
|
||||
'sudo su - -c "hadoop dfs -copyFromLocal /tmp/workflow.111'
|
||||
' /tmp/workflow" hdfs && sudo rm -f /tmp/workflow.111')
|
||||
|
Loading…
Reference in New Issue
Block a user