Revision 3f404fc5 test/ganeti.locking_unittest.py

b/test/ganeti.locking_unittest.py
291 291
    self.assert_('six' in self.ls._names())
292 292
    self.assert_('seven' in self.ls._names())
293 293
    self.assertEquals(self.ls._list_owned(), set(['five', 'six', 'seven']))
294
    self.ls.remove(['five', 'six'])
294
    self.assertEquals(self.ls.remove(['five', 'six']), ['five', 'six'])
295 295
    self.assert_('five' not in self.ls._names())
296 296
    self.assert_('six' not in self.ls._names())
297 297
    self.assertEquals(self.ls._list_owned(), set(['seven']))
......
305 305
    self.ls.remove(['two'])
306 306
    self.assert_('two' not in self.ls._names())
307 307
    self.ls.acquire('three')
308
    self.ls.remove(['three'])
308
    self.assertEquals(self.ls.remove(['three']), ['three'])
309 309
    self.assert_('three' not in self.ls._names())
310
    self.assertEquals(self.ls.remove('three'), ['three'])
311
    self.assertEquals(self.ls.remove(['one', 'three', 'six']), ['three', 'six'])
310
    self.assertEquals(self.ls.remove('three'), [])
311
    self.assertEquals(self.ls.remove(['one', 'three', 'six']), ['one'])
312 312
    self.assert_('one' not in self.ls._names())
313 313

  
314 314
  def testRemoveNonBlocking(self):
315 315
    self.assertRaises(NotImplementedError, self.ls.remove, 'one', blocking=0)
316 316
    self.ls.acquire('one')
317
    self.assertEquals(self.ls.remove('one', blocking=0), [])
317
    self.assertEquals(self.ls.remove('one', blocking=0), ['one'])
318 318
    self.ls.acquire(['two', 'three'])
319
    self.assertEquals(self.ls.remove(['two', 'three'], blocking=0), [])
319
    self.assertEquals(self.ls.remove(['two', 'three'], blocking=0),
320
                      ['two', 'three'])
320 321

  
321 322
  def testNoDoubleAdd(self):
322 323
    self.assertRaises(errors.LockError, self.ls.add, 'two')
......
406 407
    Thread(target=self._doRemoveSet, args=(['four', 'six'], )).start()
407 408
    self.assertRaises(Queue.Empty, self.done.get, True, 0.2)
408 409
    self.ls.remove('four')
409
    self.assertEqual(self.done.get(True, 1), ['four'])
410
    self.assertEqual(self.done.get(True, 1), ['six'])
410 411
    Thread(target=self._doRemoveSet, args=(['two'])).start()
411
    self.assertEqual(self.done.get(True, 1), [])
412
    self.assertEqual(self.done.get(True, 1), ['two'])
412 413
    self.ls.release()
413 414

  
414 415

  

Also available in: Unified diff