Skip to content

Commit

Permalink
[oozie] Fix capture-output in Shell action
Browse files Browse the repository at this point in the history
Adding some tests
  • Loading branch information
romainr committed Nov 26, 2012
1 parent 03ed87c commit 6a90fd6
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
<${ param['type'] }>${ param['value'] }</${ param['type'] }>
% endfor

% if node.capture_output:
<capture-output/>
% endif

${ common.distributed_cache(node.get_files(), node.get_archives()) }
</shell>
<ok to="${ node.get_child('ok') }"/>
Expand Down
43 changes: 43 additions & 0 deletions apps/oozie/src/oozie/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,49 @@ def test_workflow_gen_xml(self):
' <end name="end"/>\n'
'</workflow-app>'.split(), self.wf.to_xml().split())

def test_workflow_shell_gen_xml(self):
self.wf.node_set.filter(name='action-name-1').delete()

action1 = add_node(self.wf, 'action-name-1', 'shell', [self.wf.start], {
u'job_xml': '',
u'files': '["hello.py"]',
u'name': 'Shell',
u'job_properties': '[]',
u'capture_output': 'on',
u'command': 'hello.py',
u'archives': '[]',
u'prepares': '[]',
u'params': '[{"value":"World!","type":"argument"}]',
u'description': 'Execute a Python script printing its arguments'
})
Link(parent=action1, child=self.wf.end, name="ok").save()

xml = self.wf.to_xml()

assert_true("""
<shell xmlns="uri:oozie:shell-action:0.1">
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<exec>hello.py</exec>
<argument>World!</argument>
<capture-output/>
<file>hello.py#hello.py</file>
</shell>""" in xml, xml)

action1.capture_output = False
action1.save()

xml = self.wf.to_xml()

assert_true("""
<shell xmlns="uri:oozie:shell-action:0.1">
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<exec>hello.py</exec>
<argument>World!</argument>
<file>hello.py#hello.py</file>
</shell>""" in xml, xml)


def test_workflow_flatten_list(self):
assert_equal('[<Start: start>, <Mapreduce: action-name-1>, <Mapreduce: action-name-2>, <Mapreduce: action-name-3>, '
Expand Down

0 comments on commit 6a90fd6

Please sign in to comment.