Commit 92aca8e1 authored by Dimitris Bliablias's avatar Dimitris Bliablias Committed by Michele Tartara
Browse files

Extend unittest for gnt-os info changes



Extend unit test ganeti.query_unittest.py, to correspond to the
changes made in the 'gnt-os info' output.
Signed-off-by: default avatarDimitris Bliablias <bl.dimitris@gmail.com>
Signed-off-by: default avatarMichele Tartara <mtartara@google.com>
Reviewed-by: default avatarMichele Tartara <mtartara@google.com>
parent 7f37f0ca
......@@ -1151,6 +1151,25 @@ class TestOsQuery(unittest.TestCase):
variants = ["v00", "plain", "v3", "var0", "v33", "v20"]
api_versions = [10, 0, 15, 5]
parameters = ["zpar3", "apar9"]
os_hvps = {
"os+variant1": {
"kvm": {
"acpi": False,
"migration_downtime": 35,}
},
"os+variant2": {
"xen": {
"acpi": "noirq",
"console": "com1",}
},
}
osparameters = {
"os+variant3": {
"img_id": "Debian",
"img_passwd": "1234",
"img_format": "diskdump",
},
}
assert variants != sorted(variants) and variants != utils.NiceSort(variants)
assert (api_versions != sorted(api_versions) and
......@@ -1161,17 +1180,19 @@ class TestOsQuery(unittest.TestCase):
data = [
query.OsInfo(name="debian", valid=False, hidden=False, blacklisted=False,
variants=set(), api_versions=set(), parameters=set(),
node_status={ "some": "status", }),
node_status={ "some": "status", }, os_hvp={}, osparams={}),
query.OsInfo(name="dos", valid=True, hidden=False, blacklisted=True,
variants=set(variants),
api_versions=set(api_versions),
parameters=set(parameters),
node_status={ "some": "other", "status": None, }),
node_status={ "some": "other", "status": None, },
os_hvp=os_hvps, osparams=osparameters),
]
q = self._Create(["name", "valid", "hidden", "blacklisted", "variants",
"api_versions", "parameters", "node_status"])
"api_versions", "parameters", "node_status", "os_hvp",
"osparams"])
self.assertEqual(q.RequestedData(), set([]))
self.assertEqual(q.Query(data),
[[(constants.RS_NORMAL, "debian"),
......@@ -1181,7 +1202,9 @@ class TestOsQuery(unittest.TestCase):
(constants.RS_NORMAL, []),
(constants.RS_NORMAL, []),
(constants.RS_NORMAL, []),
(constants.RS_NORMAL, {"some": "status"})],
(constants.RS_NORMAL, {"some": "status"}),
(constants.RS_NORMAL, {}),
(constants.RS_NORMAL, {})],
[(constants.RS_NORMAL, "dos"),
(constants.RS_NORMAL, True),
(constants.RS_NORMAL, False),
......@@ -1191,7 +1214,9 @@ class TestOsQuery(unittest.TestCase):
(constants.RS_NORMAL, [0, 5, 10, 15]),
(constants.RS_NORMAL, ["apar9", "zpar3"]),
(constants.RS_NORMAL,
{ "some": "other", "status": None, })
{ "some": "other", "status": None, }),
(constants.RS_NORMAL, os_hvps),
(constants.RS_NORMAL, osparameters)
]])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment