[Kimchi-devel] [PATCH][Kimchi 6/6] Add test to check bootorder
Ramon Medeiros
ramonn at linux.vnet.ibm.com
Thu Jul 21 20:23:42 UTC 2016
Also, update new entry on a test at test_model
Signed-off-by: Ramon Medeiros <ramonn at linux.vnet.ibm.com>
---
tests/test_mockmodel.py | 2 +-
tests/test_model.py | 15 ++++++++++++++-
tests/test_rest.py | 11 +++++++++++
3 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/tests/test_mockmodel.py b/tests/test_mockmodel.py
index 45358fe..0db1ff2 100644
--- a/tests/test_mockmodel.py
+++ b/tests/test_mockmodel.py
@@ -163,7 +163,7 @@ class MockModelTests(unittest.TestCase):
keys = set(('name', 'state', 'stats', 'uuid', 'memory', 'cpu_info',
'screenshot', 'icon', 'graphics', 'users', 'groups',
- 'access', 'persistent'))
+ 'access', 'persistent', 'bootorder'))
stats_keys = set(('cpu_utilization', 'mem_utilization',
'net_throughput', 'net_throughput_peak',
diff --git a/tests/test_model.py b/tests/test_model.py
index 9a6a1aa..09ef995 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -118,7 +118,7 @@ class ModelTests(unittest.TestCase):
keys = set(('name', 'state', 'stats', 'uuid', 'memory', 'cpu_info',
'screenshot', 'icon', 'graphics', 'users', 'groups',
- 'access', 'persistent'))
+ 'access', 'persistent', 'bootorder'))
stats_keys = set(('cpu_utilization', 'mem_utilization',
'net_throughput', 'net_throughput_peak',
@@ -1124,6 +1124,19 @@ class ModelTests(unittest.TestCase):
self.assertEquals([], inst.vm_lookup(u'пeω-∨м')['users'])
self.assertEquals([], inst.vm_lookup(u'пeω-∨м')['groups'])
+ # change bootorder
+ b_order = ["hd", "network", "cdrom"]
+ inst.vm_update(u'пeω-∨м', {"bootorder": b_order})
+ self.assertEquals(b_order, inst.vm_lookup(u'пeω-∨м')['bootorder'])
+
+ # try to add empty list
+ self.assertRaises(OperationFailed, inst.vm_update, u'пeω-∨м',
+ {"bootorder": [""]})
+
+ # try to pass invalid parameter
+ self.assertRaises(OperationFailed, inst.vm_update, u'пeω-∨м',
+ {"bootorder": ["bla"]})
+
def test_get_interfaces(self):
inst = model.Model('test:///default',
objstore_loc=self.tmp_store)
diff --git a/tests/test_rest.py b/tests/test_rest.py
index 1a43411..57fbb6e 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -290,6 +290,17 @@ class RestTests(unittest.TestCase):
resp = self.request('/plugins/kimchi/vms/∨м-црdαtеd', req, 'PUT')
self.assertEquals(400, resp.status)
+ # change bootorder
+ b_order = ["hd", "network", "cdrom"]
+ req = json.dumps({"bootorder": b_order})
+ resp = self.request('/plugins/kimchi/vms/∨м-црdαtеd', req, 'PUT')
+ self.assertEquals(200, resp.status)
+ self.assertEquals(json.loads(resp.read())["bootorder"], b_order)
+
+ req = json.dumps({"bootorder": ["bla"]})
+ resp = self.request('/plugins/kimchi/vms/∨м-црdαtеd', req, 'PUT')
+ self.assertEquals(400, resp.status)
+
def test_vm_lifecycle(self):
# Create a Template
req = json.dumps({'name': 'test',
--
2.5.5
More information about the Kimchi-devel
mailing list