From dfa0fa34b4e1673bf05c82cc12bdd8eeb3e5cff0 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Tue, 20 Feb 2018 10:10:08 -0500 Subject: [PATCH] tests: xmlparse: Add a roundtrip metadata test To ensure the xml engine doesn't mangle unknown XML --- tests/xmlparse-xml/domain-roundtrip.xml | 47 +++++++++++++++++++++++++ tests/xmlparse.py | 8 +++++ 2 files changed, 55 insertions(+) create mode 100644 tests/xmlparse-xml/domain-roundtrip.xml diff --git a/tests/xmlparse-xml/domain-roundtrip.xml b/tests/xmlparse-xml/domain-roundtrip.xml new file mode 100644 index 000000000..0190c440d --- /dev/null +++ b/tests/xmlparse-xml/domain-roundtrip.xml @@ -0,0 +1,47 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + foo + + + + + + + fooish + fooish + fooish + barish + fooish + barish + + + vm1 + 2015-02-19 18:23:44 + + 512 + 1 + 0 + 0 + 1 + + + admin + demo + + + + + installed + /tmp/media.iso + + + diff --git a/tests/xmlparse.py b/tests/xmlparse.py index e53653377..ef12eb516 100644 --- a/tests/xmlparse.py +++ b/tests/xmlparse.py @@ -1400,6 +1400,14 @@ class XMLParseTest(unittest.TestCase): guest.cpu.clear() utils.diff_compare(guest.get_xml_config(), outfile) + def testDomainRoundtrip(self): + # Make sure our XML engine doesn't mangle non-libvirt XML bits + infile = "tests/xmlparse-xml/domain-roundtrip.xml" + outfile = "tests/xmlparse-xml/domain-roundtrip.xml" + guest = virtinst.Guest(kvmconn, parsexml=open(infile).read()) + + utils.diff_compare(guest.get_xml_config(), outfile) + if __name__ == "__main__": unittest.main()