本文整理汇总了Python中tests.ise.tools.getMockActionCmd函数的典型用法代码示例。如果您正苦于以下问题:Python getMockActionCmd函数的具体用法?Python getMockActionCmd怎么用?Python getMockActionCmd使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getMockActionCmd函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_P_ASA_OK
def test_P_ASA_OK(self):
"""
A parallel composed of an action, a sequence (with 2
actions) and an action
"""
doc = ISE(PAR(ACTION(tools.getMockActionCmd(ACTION_RC_OK,
"A1.STD", "A1.ERR"),
id="1"),
SEQ(ACTION(tools.getMockActionCmd(ACTION_RC_OK,
"A2.STD", "A2.ERR"),
id="2"),
ACTION(tools.getMockActionCmd(ACTION_RC_OK,
"A3.STD", "A3.ERR"),
id="3")),
ACTION(tools.getMockActionCmd(ACTION_RC_OK,
"A4.STD", "A4.ERR"),
id="4"),
desc="P_ASA_OK")
)
xml = lxml.etree.tostring(doc, pretty_print=True)
print(xml)
with io.StringIO(unicode(xml)) as reader:
execution = api.execute(reader)
self.assertEquals(ACTION_RC_OK, execution.rc)
actionsMap = execution.executed_actions
self.assertEquals(4, len(actionsMap))
self.assertEquals(0, len(execution.error_actions))
for i in range(1, 5):
self.assertActionAttributes(actionsMap, str(i))
self._checkPASAOrder(actionsMap)
开发者ID:af-bull,项目名称:sequencer,代码行数:33,代码来源:testapi.py
示例2: test_P_A_Deps_A_KO
def test_P_A_Deps_A_KO(self):
"""
A parallel with two actions. The first one has an explicit
dependency on the last one. The last one will fail.
This is not supported: any id referenced in a deps should be
defined first in the document.
"""
doc = ISE(PAR(ACTION(tools.getMockActionCmd(ACTION_RC_OK,
"A1.STD", "A1.ERR"),
id="1", deps="2"),
ACTION(tools.getMockActionCmd(ACTION_RC_KO,
"A2.STD", "A2.ERR"),
id="2"),
desc="P_A_Deps_A_KO")
)
xml = lxml.etree.tostring(doc, pretty_print=True)
print(xml)
with io.StringIO(unicode(xml)) as reader:
execution = api.execute(reader)
self.assertEquals(ACTION_RC_KO, execution.rc)
actionsMap = execution.executed_actions
self.assertEquals(1, len(actionsMap))
self.assertEquals(1, len(execution.error_actions))
a1 = actionsMap["2"]
self.assertEquals(a1.rc, ACTION_RC_KO)
self.assertEquals(a1.stdout, "A2.STD")
self.assertEquals(a1.stderr, "A2.ERR")
开发者ID:af-bull,项目名称:sequencer,代码行数:30,代码来源:testapi.py
示例3: test_PAA_KO
def test_PAA_KO(self):
"""
A parallel, where second action returns KO -> first action
should have been executed
"""
doc = ISE(PAR(ACTION(tools.getMockActionCmd(ACTION_RC_OK,
"A1.STD", "A1.ERR"),
id="1"),
ACTION(tools.getMockActionCmd(ACTION_RC_KO,
"A2.STD", "A2.ERR"),
id="2"),
desc="PAA_KO")
)
xml = lxml.etree.tostring(doc, pretty_print=True)
print(xml)
with io.StringIO(unicode(xml)) as reader:
execution = api.execute(reader)
actionsMap = execution.executed_actions
self.assertEquals(2, len(actionsMap))
self.assertEquals(1, len(execution.error_actions))
self.assertTrue("1" in actionsMap)
self.assertTrue("2" in actionsMap)
self.assertTrue("2" in execution.error_actions)
action = actionsMap["1"]
self.assertEquals(action.rc, ACTION_RC_OK)
self.assertEquals(action.stdout, "A1.STD")
self.assertEquals(action.stderr, "A1.ERR")
action = actionsMap["2"]
self.assertEquals(action.rc, ACTION_RC_KO)
self.assertEquals(action.stdout, "A2.STD")
self.assertEquals(action.stderr, "A2.ERR")
开发者ID:af-bull,项目名称:sequencer,代码行数:33,代码来源:testapi.py
示例4: test_P_A_KO_A_Deps
def test_P_A_KO_A_Deps(self):
"""
A parallel with two actions. The second action has an explicit
dependency on the first one. The first one will fail.
"""
doc = ISE(PAR(ACTION(tools.getMockActionCmd(ACTION_RC_KO,
"A1.STD", "A1.ERR"),
id="1"),
ACTION(tools.getMockActionCmd(ACTION_RC_OK,
"A2.STD", "A2.ERR"),
id="2", deps="1"),
desc="P_A_KO_A_Deps")
)
xml = lxml.etree.tostring(doc, pretty_print=True)
print(xml)
with io.StringIO(unicode(xml)) as reader:
execution = api.execute(reader)
self.assertEquals(ACTION_RC_KO, execution.rc)
actionsMap = execution.executed_actions
self.assertEquals(1, len(actionsMap))
self.assertEquals(1, len(execution.error_actions))
self.assertTrue("1" in actionsMap)
self.assertTrue("1" in execution.error_actions)
a1 = actionsMap["1"]
self.assertEquals(a1.rc, ACTION_RC_KO)
self.assertEquals(a1.stdout, "A1.STD")
self.assertEquals(a1.stderr, "A1.ERR")
开发者ID:af-bull,项目名称:sequencer,代码行数:29,代码来源:testapi.py
示例5: _test_SA_rc_A
def _test_SA_rc_A(self, rc):
""" A sequence, where first action returns given rc -> next action
should not be executed
rc should be either WARNING or KO
"""
doc = ISE(SEQ(ACTION(tools.getMockActionCmd(rc,
"A1.STD", "A1.ERR"),
id="1"),
ACTION(tools.getMockActionCmd(ACTION_RC_OK,
"A2.STD", "A2.ERR"),
id="2"),
desc="SA_" + str(rc) + "_A")
)
xml = lxml.etree.tostring(doc, pretty_print=True)
print(xml)
with io.StringIO(unicode(xml)) as reader:
execution = api.execute(reader)
actionsMap = execution.executed_actions
self.assertEquals(1, len(actionsMap))
self.assertEquals(1, len(execution.error_actions))
self.assertTrue("1" in actionsMap)
self.assertTrue("1" in execution.error_actions)
action = actionsMap["1"]
self.assertEquals(action.rc, rc)
self.assertEquals(action.stdout, "A1.STD")
self.assertEquals(action.stderr, "A1.ERR")
开发者ID:af-bull,项目名称:sequencer,代码行数:29,代码来源:testapi.py
示例6: test_P_AA
def test_P_AA(self):
doc = ISE(
PAR(ACTION(
tools.getMockActionCmd(ACTION_RC_OK, "A1.STD", "A1.ERR"),
id="1"),
ACTION(
tools.getMockActionCmd(ACTION_RC_OK, "A2.STD", "A2.ERR"),
id="2",
deps="1"),
desc="P_AA"))
xml = lxml.etree.tostring(doc, pretty_print=True)
print(xml)
with io.StringIO(unicode(xml)) as reader:
execution = api.execute(reader)
self.assertEquals(ACTION_RC_OK, execution.rc)
actionsMap = execution.executed_actions
self.assertEquals(2, len(actionsMap))
for i in range(1, 2):
self.assertActionAttributes(actionsMap, str(i))
a1 = actionsMap["1"]
a2 = actionsMap["2"]
self.assertTrue(a2.started_time > a1.ended_time)
开发者ID:pv-bull,项目名称:sequencer,代码行数:25,代码来源:testapi.py
示例7: _get_SA_W_A_Force_doc
def _get_SA_W_A_Force_doc(self, force_attr):
return ISE(SEQ(ACTION(tools.getMockActionCmd(ACTION_RC_WARNING,
"A1.STD", "A1.ERR"),
id="1",
force=force_attr),
ACTION(tools.getMockActionCmd(ACTION_RC_OK,
"A2.STD", "A2.ERR"),
id="2"),
desc="SA_W_A_Force_" + force_attr)
)
开发者ID:af-bull,项目名称:sequencer,代码行数:10,代码来源:testapi.py
示例8: test_AggregatedRemote
def test_AggregatedRemote(self):
"""
This test needs an SSH configuration that allows command to
get executed on test1, test2, test3 without a password.
You might consider writing into your ~/.ssh/config file the
following to make it works:
Host test1
HostName localhost
Host test2
HostName localhost
Host test3
HostName localhost
"""
doc = ISE(PAR(ACTION(tools.getMockActionCmd(ACTION_RC_OK,
"Message2StdOut",
"Message2StdErr"),
id="AggregatedRemote", remote="true",
component_set="test[1-3]#compute")))
self._checkSimpleAction(doc,
"AggregatedRemote",
ACTION_RC_OK,
"test[1-3]: Message2StdOut",
"test[1-3]: Message2StdErr")
开发者ID:af-bull,项目名称:sequencer,代码行数:28,代码来源:testapi.py
示例9: test_SimpleSequenceActionWarning
def test_SimpleSequenceActionWarning(self):
doc = ISE(SEQ(ACTION(tools.getMockActionCmd(ACTION_RC_WARNING,
"Message2StdOut",
"Message2StdErr"),
id="SimpleSequenceActionWarning")))
self._checkSimpleAction(doc,
"SimpleSequenceActionWarning",
ACTION_RC_WARNING,
"Message2StdOut", "Message2StdErr")
开发者ID:af-bull,项目名称:sequencer,代码行数:9,代码来源:testapi.py
示例10: test_SimpleSequenceActionKO
def test_SimpleSequenceActionKO(self):
doc = ISE(SEQ(ACTION(tools.getMockActionCmd(ACTION_RC_KO,
"Message2StdOut",
"Message2StdErr"),
id="SimpleSequenceActionKO")))
self._checkSimpleAction(doc,
"SimpleSequenceActionKO",
ACTION_RC_KO,
"Message2StdOut", "Message2StdErr")
开发者ID:af-bull,项目名称:sequencer,代码行数:9,代码来源:testapi.py
示例11: test_SimpleParallelActionOK
def test_SimpleParallelActionOK(self):
doc = ISE(PAR(ACTION(tools.getMockActionCmd(ACTION_RC_OK,
"Message2StdOut",
"Message2StdErr"),
id="SimpleParallelActionOK")))
self._checkSimpleAction(doc,
"SimpleParallelActionOK",
ACTION_RC_OK,
"Message2StdOut", "Message2StdErr")
开发者ID:af-bull,项目名称:sequencer,代码行数:9,代码来源:testapi.py
示例12: test_P_A_W_AA_Deps_Force
def test_P_A_W_AA_Deps_Force(self):
"""
A parallel with three actions. The last one has an explicit
dependency on first ones. The first one will fail with a
WARNING but with force mode. Therefore, the second one should
get executed, *and* also the third one.
"""
doc = ISE(
PAR(ACTION(
tools.getMockActionCmd(ACTION_RC_WARNING, "A1.STD", "A1.ERR"),
id="1"),
ACTION(
tools.getMockActionCmd(ACTION_RC_OK, "A2.STD", "A2.ERR"),
id="2"),
ACTION(
tools.getMockActionCmd(ACTION_RC_OK, "A3.STD", "A3.ERR"),
id="3",
deps="1,2"),
desc="P_A_W_AA_Deps_Force"))
xml = lxml.etree.tostring(doc, pretty_print=True)
print(xml)
with io.StringIO(unicode(xml)) as reader:
execution = api.execute(reader, force=True)
self.assertEquals(ACTION_RC_WARNING, execution.rc)
actionsMap = execution.executed_actions
self.assertEquals(3, len(actionsMap),
"actionsMap: %s" % actionsMap)
self.assertEquals(0, len(execution.error_actions))
self.assertTrue("1" in actionsMap)
self.assertTrue("2" in actionsMap)
self.assertTrue("3" in actionsMap)
a1 = actionsMap["1"]
self.assertEquals(a1.rc, ACTION_RC_WARNING)
self.assertEquals(a1.stdout, "A1.STD")
self.assertEquals(a1.stderr, "A1.ERR")
a2 = actionsMap["2"]
self.assertEquals(a2.rc, ACTION_RC_OK)
self.assertEquals(a2.stdout, "A2.STD")
self.assertEquals(a2.stderr, "A2.ERR")
a3 = actionsMap["3"]
self.assertEquals(a3.rc, ACTION_RC_OK)
self.assertEquals(a3.stdout, "A3.STD")
self.assertEquals(a3.stderr, "A3.ERR")
开发者ID:pv-bull,项目名称:sequencer,代码行数:44,代码来源:testapi.py
示例13: _test_P_A_rc_AA_Deps
def _test_P_A_rc_AA_Deps(self, rc):
"""
A parallel with three actions. The last one has an explicit
dependency on first ones. The first one will fail with rc
(either WARNING or KO). Therefore, the second one should get
executed, but not the third one.
"""
doc = ISE(PAR(ACTION(tools.getMockActionCmd(rc,
"A1.STD", "A1.ERR"),
id="1"),
ACTION(tools.getMockActionCmd(ACTION_RC_OK,
"A2.STD", "A2.ERR"),
id="2"),
ACTION(tools.getMockActionCmd(ACTION_RC_OK,
"A3.STD", "A3.ERR"),
id="3", deps="1,2"),
desc="P_A_" + str(rc) + "_AA_Deps")
)
xml = lxml.etree.tostring(doc, pretty_print=True)
print(xml)
with io.StringIO(unicode(xml)) as reader:
execution = api.execute(reader)
self.assertEquals(rc, execution.rc)
actionsMap = execution.executed_actions
self.assertEquals(2, len(actionsMap), "actionsMap: %s" % actionsMap)
self.assertEquals(1, len(execution.error_actions))
self.assertTrue("1" in actionsMap)
self.assertTrue("2" in actionsMap)
self.assertTrue("1" in execution.error_actions)
a1 = actionsMap["1"]
self.assertEquals(a1.rc, rc)
self.assertEquals(a1.stdout, "A1.STD")
self.assertEquals(a1.stderr, "A1.ERR")
a2 = actionsMap["2"]
self.assertEquals(a2.rc, ACTION_RC_OK)
self.assertEquals(a2.stdout, "A2.STD")
self.assertEquals(a2.stderr, "A2.ERR")
开发者ID:af-bull,项目名称:sequencer,代码行数:38,代码来源:testapi.py
示例14: test_SimpleRemote
def test_SimpleRemote(self):
"""
This test needs an SSH configuration that allows command to
get executed on localhost without a password. Read ssh for
details (or ClusterShell actually).
"""
doc = ISE(PAR(ACTION(tools.getMockActionCmd(ACTION_RC_OK,
"Message2StdOut",
"Message2StdErr"),
id="SimpleRemote", remote="true",
component_set="localhost#compute")))
self._checkSimpleAction(doc,
"SimpleRemote",
ACTION_RC_OK,
"localhost: Message2StdOut",
"localhost: Message2StdErr")
开发者ID:af-bull,项目名称:sequencer,代码行数:16,代码来源:testapi.py
注:本文中的tests.ise.tools.getMockActionCmd函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论