Skip to content

Commit

Permalink
Dev: unittests: Adjust unit test for previous changes
Browse files Browse the repository at this point in the history
  • Loading branch information
liangxin1300 committed Jan 12, 2025
1 parent a784913 commit f7f69bc
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 36 deletions.
1 change: 0 additions & 1 deletion test/unittests/test_bugs.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,6 @@ def test_id_collision_breakage_1(mock_incr, mock_line_num):
primitive p3 ocf:pacemaker:Dummy
primitive st stonith:null params hostlist=node1
clone c1 p1
ms m1 p2
op_defaults timeout=60s
""")
assert ok
Expand Down
14 changes: 0 additions & 14 deletions test/unittests/test_cliformat.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,20 +208,6 @@ def test_fencing2():
assert obj.cli_use_validate()


def test_master():
xml = """<master id="ms-1">
<crmsh-ref id="dummy3" />
</master>
"""
data = etree.fromstring(xml)
factory.create_from_cli("primitive dummy3 ocf:pacemaker:Dummy")
data, _, _ = cibconfig.postprocess_cli(data)
print("after postprocess:", etree.tostring(data))
obj = factory.create_from_node(data)
assert_is_not_none(obj)
assert obj.cli_use_validate()


def test_param_rules():
roundtrip('primitive foo Dummy ' +
'params rule #uname eq wizbang laser=yes ' +
Expand Down
21 changes: 0 additions & 21 deletions test/unittests/test_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,21 +174,6 @@ def test_resources(self, mock_error):
out = self._parse('primitive st stonith:null params hostlist=node1 meta requires=nothing description="some description here" op start op monitor interval=60m')
self.assertEqual(out.get('id'), 'st')

out = self._parse('ms m0 resource params a=b')
self.assertEqual(out.get('id'), 'm0')
print(xml_tostring(out))
self.assertEqual(['resource'], out.xpath('./crmsh-ref/@id'))
self.assertEqual(['b'], out.xpath('instance_attributes/nvpair[@name="a"]/@value'))

out2 = self._parse('ms m0 resource a=b')
self.assertEqual(out.get('id'), 'm0')
self.assertEqual(xml_tostring(out), xml_tostring(out2))

out = self._parse('master ma resource meta a=b')
self.assertEqual(out.get('id'), 'ma')
self.assertEqual(['resource'], out.xpath('./crmsh-ref/@id'))
self.assertEqual(['b'], out.xpath('meta_attributes/nvpair[@name="a"]/@value'))

out = self._parse('clone clone-1 resource meta a=b')
self.assertEqual(out.get('id'), 'clone-1')
self.assertEqual(['resource'], out.xpath('./crmsh-ref/@id'))
Expand Down Expand Up @@ -658,13 +643,10 @@ def test_configs(self, mock_error):
"""clone c d3 \
meta clone-max=1""",
"""primitive d4 ocf:pacemaker:Dummy""",
"""ms m d4""",
"""primitive s5 ocf:pacemaker:Stateful \
operations $id-ref=d1-ops""",
"""primitive s6 ocf:pacemaker:Stateful \
operations $id-ref=d1""",
"""ms m5 s5""",
"""ms m6 s6""",
"""location l1 g1 100: node1""",
"""location l2 c \
rule $id=l2-rule1 100: #uname eq node1""",
Expand Down Expand Up @@ -713,11 +695,8 @@ def test_configs(self, mock_error):
'<primitive id="d3" class="ocf" provider="pacemaker" type="Dummy"/>',
'<clone id="c"><meta_attributes><nvpair name="clone-max" value="1"/></meta_attributes><crmsh-ref id="d3"/></clone>',
'<primitive id="d4" class="ocf" provider="pacemaker" type="Dummy"/>',
'<master id="m"><crmsh-ref id="d4"/></master>',
'<primitive id="s5" class="ocf" provider="pacemaker" type="Stateful"><operations id-ref="d1-ops"/></primitive>',
'<primitive id="s6" class="ocf" provider="pacemaker" type="Stateful"><operations id-ref="d1"/></primitive>',
'<master id="m5"><crmsh-ref id="s5"/></master>',
'<master id="m6"><crmsh-ref id="s6"/></master>',
'<rsc_location id="l1" rsc="g1" score="100" node="node1"/>',
'<rsc_location id="l2" rsc="c"><rule id="l2-rule1" score="100"><expression operation="eq" attribute="#uname" value="node1"/></rule></rsc_location>',
'<rsc_location id="l3" rsc="m5"><rule score="INFINITY"><expression operation="eq" attribute="#uname" value="node1"/><expression operation="gt" attribute="pingd" value="0"/></rule></rsc_location>',
Expand Down

0 comments on commit f7f69bc

Please sign in to comment.