Exemple #1
0
 def testTimeout(self):
   fn = testutils.CallCounter(self._Fail)
   try:
     hv_xen._GetRunningInstanceList(fn, False, delays=(0.02, 1.0, 0.03),
                                    timeout=0.1)
   except errors.HypervisorError, err:
     self.assertTrue("timeout exceeded" in str(err))
  def testTimeout(self):
    fn = testutils.CallCounter(self._Fail)
    try:
      hv_xen._GetRunningInstanceList(fn, False, delays=(0.02, 1.0, 0.03),
                                     timeout=0.1)
    except errors.HypervisorError as err:
      self.assertTrue("timeout exceeded" in str(err))
    else:
      self.fail("Exception was not raised")

    self.assertTrue(fn.Count() < 10,
                    msg="'xm list' was called too many times")
Exemple #3
0
    def testTimeout(self):
        fn = testutils.CallCounter(self._Fail)
        try:
            hv_xen._GetRunningInstanceList(fn,
                                           False,
                                           delays=(0.02, 1.0, 0.03),
                                           timeout=0.1)
        except errors.HypervisorError as err:
            self.assertTrue("timeout exceeded" in str(err))
        else:
            self.fail("Exception was not raised")

        self.assertTrue(fn.Count() < 10,
                        msg="'xm list' was called too many times")
Exemple #4
0
    def testSuccess(self):
        data = testutils.ReadTestData("xen-xm-list-4.0.1-four-instances.txt")

        fn = testutils.CallCounter(compat.partial(self._Success, data))

        result = hv_xen._GetRunningInstanceList(fn, True, _timeout=0.1)

        self.assertEqual(len(result), 4)

        self.assertEqual(map(compat.fst, result), [
            "Domain-0",
            "server01.example.com",
            "web3106215069.example.com",
            "testinstance.example.com",
        ])

        self.assertEqual(fn.Count(), 1)
  def testSuccess(self):
    data = testutils.ReadTestData("xen-xm-list-4.0.1-four-instances.txt")

    fn = testutils.CallCounter(compat.partial(self._Success, data))

    result = hv_xen._GetRunningInstanceList(fn, True, _timeout=0.1)

    self.assertEqual(len(result), 4)

    self.assertEqual(map(compat.fst, result), [
      "Domain-0",
      "server01.example.com",
      "web3106215069.example.com",
      "testinstance.example.com",
      ])

    self.assertEqual(fn.Count(), 1)