On Tue, Dec 3, 2013 at 10:45 AM, Jose A. Lopes <[email protected]> wrote: > Update hypervisor unit tests. > > Partial cherry-pick from d2e4e099e4248832fef8ed7b0755d01bd4178e3a > > Signed-off-by: Jose A. Lopes <[email protected]> > Reviewed-by: Hrvoje Ribicic <[email protected]> > --- > test/py/ganeti.hypervisor.hv_xen_unittest.py | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/test/py/ganeti.hypervisor.hv_xen_unittest.py > b/test/py/ganeti.hypervisor.hv_xen_unittest.py > index e87e62f..2584c0d 100755 > --- a/test/py/ganeti.hypervisor.hv_xen_unittest.py > +++ b/test/py/ganeti.hypervisor.hv_xen_unittest.py > @@ -552,10 +552,16 @@ class _TestXenHypervisor(object): > self.assertTrue(("extra = '%s'" % extra) in lines) > > def _StopInstanceCommand(self, instance_name, force, fail, cmd): > - if ((force and cmd[:2] == [self.CMD, "destroy"]) or > - (not force and cmd[:2] == [self.CMD, "shutdown"])): > + if (cmd == [self.CMD, "list"]): > + output = "Name ID Mem VCPUs State Time(s)\n" \ > + "Domain-0 0 1023 1 r----- 142691.0\n" \ > + "%s 417 128 1 r----- 3.2\n" % instance_name > + elif cmd[:2] == [self.CMD, "destroy"]: > self.assertEqual(cmd[2:], [instance_name]) > output = "" > + elif not force and cmd[:3] == [self.CMD, "shutdown", "-w"]: > + self.assertEqual(cmd[3:], [instance_name]) > + output = "" > else: > self.fail("Unhandled command: %s" % (cmd, )) > > @@ -584,7 +590,8 @@ class _TestXenHypervisor(object): > try: > hv._StopInstance(name, force) > except errors.HypervisorError, err: > - self.assertTrue(str(err).startswith("Failed to stop instance")) > + self.assertTrue(str(err).startswith("xm list failed"), > + msg=str(err)) > else: > self.fail("Exception was not raised") > self.assertEqual(utils.ReadFile(cfgfile), cfgdata, > -- > 1.8.4.1 >
LGTM, thanks. Michele -- Google Germany GmbH Dienerstr. 12 80331 München Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Graham Law, Christine Elizabeth Flores
