def testOutOfRange(self):
   for (name, val) in ((constants.ISPEC_MEM_SIZE, 64),
                       (constants.ISPEC_MEM_SIZE, 768),
                       (constants.ISPEC_DISK_SIZE, 4096),
                       (constants.ISPEC_DISK_COUNT, 0)):
     min_v = self.ispecs[constants.ISPECS_MIN].get(name, val)
     max_v = self.ispecs[constants.ISPECS_MAX].get(name, val)
     self.assertEqual(common._ComputeMinMaxSpec(name, None,
                                                self.ispecs, val),
                      "%s value %s is not in range [%s, %s]" %
                      (name, val,min_v, max_v))
     self.assertEqual(common._ComputeMinMaxSpec(name, "1",
                                                self.ispecs, val),
                      "%s/1 value %s is not in range [%s, %s]" %
                      (name, val,min_v, max_v))
Beispiel #2
0
 def testOutOfRange(self):
   for (name, val) in ((constants.ISPEC_MEM_SIZE, 64),
                       (constants.ISPEC_MEM_SIZE, 768),
                       (constants.ISPEC_DISK_SIZE, 4096),
                       (constants.ISPEC_DISK_COUNT, 0)):
     min_v = self.ispecs[constants.ISPECS_MIN].get(name, val)
     max_v = self.ispecs[constants.ISPECS_MAX].get(name, val)
     self.assertEqual(common._ComputeMinMaxSpec(name, None,
                                                self.ispecs, val),
                      "%s value %s is not in range [%s, %s]" %
                      (name, val,min_v, max_v))
     self.assertEqual(common._ComputeMinMaxSpec(name, "1",
                                                self.ispecs, val),
                      "%s/1 value %s is not in range [%s, %s]" %
                      (name, val,min_v, max_v))
Beispiel #3
0
 def test(self):
   for (name, val) in ((constants.ISPEC_MEM_SIZE, 256),
                       (constants.ISPEC_MEM_SIZE, 128),
                       (constants.ISPEC_MEM_SIZE, 512),
                       (constants.ISPEC_DISK_SIZE, 1024),
                       (constants.ISPEC_DISK_SIZE, 0),
                       (constants.ISPEC_DISK_COUNT, 1),
                       (constants.ISPEC_DISK_COUNT, 5)):
     self.assertTrue(common._ComputeMinMaxSpec(name, None, self.ispecs, val)
                     is None)
 def test(self):
   for (name, val) in ((constants.ISPEC_MEM_SIZE, 256),
                       (constants.ISPEC_MEM_SIZE, 128),
                       (constants.ISPEC_MEM_SIZE, 512),
                       (constants.ISPEC_DISK_SIZE, 1024),
                       (constants.ISPEC_DISK_SIZE, 0),
                       (constants.ISPEC_DISK_COUNT, 1),
                       (constants.ISPEC_DISK_COUNT, 5)):
     self.assertTrue(common._ComputeMinMaxSpec(name, None, self.ispecs, val)
                     is None)
Beispiel #5
0
 def testNoMaxDefined(self):
   self.assertTrue(common._ComputeMinMaxSpec(constants.ISPEC_DISK_COUNT,
                                             None, self.ispecs, 16) is None)
Beispiel #6
0
 def testNoMinDefined(self):
   self.assertTrue(common._ComputeMinMaxSpec(constants.ISPEC_DISK_SIZE, None,
                                             self.ispecs, 128) is None)
Beispiel #7
0
 def testNotDefined(self):
   self.assertTrue(common._ComputeMinMaxSpec(constants.ISPEC_NIC_COUNT, None,
                                             self.ispecs, 3) is None)
Beispiel #8
0
 def testAutoValue(self):
   self.assertTrue(common._ComputeMinMaxSpec(constants.ISPEC_MEM_SIZE, None,
                                             self.ispecs,
                                             constants.VALUE_AUTO) is None)
Beispiel #9
0
 def testNoneValue(self):
   self.assertTrue(common._ComputeMinMaxSpec(constants.ISPEC_MEM_SIZE, None,
                                             self.ispecs, None) is None)
 def testNoMaxDefined(self):
   self.assertTrue(common._ComputeMinMaxSpec(constants.ISPEC_DISK_COUNT,
                                             None, self.ispecs, 16) is None)
 def testNoMinDefined(self):
   self.assertTrue(common._ComputeMinMaxSpec(constants.ISPEC_DISK_SIZE, None,
                                             self.ispecs, 128) is None)
 def testNotDefined(self):
   self.assertTrue(common._ComputeMinMaxSpec(constants.ISPEC_NIC_COUNT, None,
                                             self.ispecs, 3) is None)
 def testAutoValue(self):
   self.assertTrue(common._ComputeMinMaxSpec(constants.ISPEC_MEM_SIZE, None,
                                             self.ispecs,
                                             constants.VALUE_AUTO) is None)
 def testNoneValue(self):
   self.assertTrue(common._ComputeMinMaxSpec(constants.ISPEC_MEM_SIZE, None,
                                             self.ispecs, None) is None)