Revision 3fc1dc2f test/py/ganeti.hypervisor.hv_xen_unittest.py

b/test/py/ganeti.hypervisor.hv_xen_unittest.py
552 552
          self.assertTrue(("extra = '%s'" % extra) in lines)
553 553

  
554 554
  def _StopInstanceCommand(self, instance_name, force, fail, cmd):
555
    if ((force and cmd[:2] == [self.CMD, "destroy"]) or
556
        (not force and cmd[:2] == [self.CMD, "shutdown"])):
555
    if (cmd == [self.CMD, "list"]):
556
      output = "Name  ID  Mem  VCPUs  State  Time(s)\n" \
557
        "Domain-0  0  1023  1  r-----  142691.0\n" \
558
        "%s  417  128  1  r-----  3.2\n" % instance_name
559
    elif cmd[:2] == [self.CMD, "destroy"]:
557 560
      self.assertEqual(cmd[2:], [instance_name])
558 561
      output = ""
562
    elif not force and cmd[:3] == [self.CMD, "shutdown", "-w"]:
563
      self.assertEqual(cmd[3:], [instance_name])
564
      output = ""
559 565
    else:
560 566
      self.fail("Unhandled command: %s" % (cmd, ))
561 567

  
......
584 590
          try:
585 591
            hv._StopInstance(name, force)
586 592
          except errors.HypervisorError, err:
587
            self.assertTrue(str(err).startswith("Failed to stop instance"))
593
            self.assertTrue(str(err).startswith("xm list failed"),
594
                            msg=str(err))
588 595
          else:
589 596
            self.fail("Exception was not raised")
590 597
          self.assertEqual(utils.ReadFile(cfgfile), cfgdata,

Also available in: Unified diff