Revision 347fa0f1 test/py/ganeti.hypervisor.hv_xen_unittest.py

b/test/py/ganeti.hypervisor.hv_xen_unittest.py
44 44
      self.assertEqual(cons.command[-1], instance.name)
45 45

  
46 46

  
47
class TestCreateConfigCpus(unittest.TestCase):
48
  def testEmpty(self):
49
    for cpu_mask in [None, ""]:
50
      self.assertEqual(hv_xen._CreateConfigCpus(cpu_mask),
51
                       "cpus = [  ]")
52

  
53
  def testAll(self):
54
    self.assertEqual(hv_xen._CreateConfigCpus(constants.CPU_PINNING_ALL),
55
                     None)
56

  
57
  def testOne(self):
58
    self.assertEqual(hv_xen._CreateConfigCpus("9"), "cpu = \"9\"")
59

  
60
  def testMultiple(self):
61
    self.assertEqual(hv_xen._CreateConfigCpus("0-2,4,5-5:3:all"),
62
                     ("cpus = [ \"0,1,2,4,5\", \"3\", \"%s\" ]" %
63
                      constants.CPU_PINNING_ALL_XEN))
64

  
65

  
47 66
if __name__ == "__main__":
48 67
  testutils.GanetiTestProgram()

Also available in: Unified diff