Beispiel #1
0
    def test_stack_lock_steal_fail_stolen(self):
        db_api.stack_lock_create(self.stack.id, UUID1)

        # Simulate stolen lock
        db_api.stack_lock_release(self.stack.id, UUID1)
        db_api.stack_lock_create(self.stack.id, UUID2)

        observed = db_api.stack_lock_steal(self.stack.id, UUID3, UUID2)
        self.assertEqual(UUID2, observed)
Beispiel #2
0
 def test_stack_lock_release(self):
     create_stack_lock(self.ctx, self.stack.id, UUID1)
     db_api.stack_lock_release(self.ctx, self.stack.id)
     lock = db_api.stack_lock_get(self.ctx, self.stack.id)
     self.assertIsNone(lock)
Beispiel #3
0
 def test_stack_lock_release_fail_wrong_engine_id(self):
     db_api.stack_lock_create(self.stack.id, UUID1)
     observed = db_api.stack_lock_release(self.stack.id, UUID2)
     self.assertTrue(observed)
Beispiel #4
0
 def test_stack_lock_release_fail_double(self):
     db_api.stack_lock_create(self.stack.id, UUID1)
     db_api.stack_lock_release(self.stack.id, UUID1)
     observed = db_api.stack_lock_release(self.stack.id, UUID1)
     self.assertTrue(observed)
Beispiel #5
0
 def test_stack_lock_release_success(self):
     db_api.stack_lock_create(self.stack.id, UUID1)
     observed = db_api.stack_lock_release(self.stack.id, UUID1)
     self.assertIsNone(observed)
Beispiel #6
0
 def test_stack_lock_steal_fail_gone(self):
     db_api.stack_lock_create(self.stack.id, UUID1)
     db_api.stack_lock_release(self.stack.id, UUID1)
     observed = db_api.stack_lock_steal(self.stack.id, UUID1, UUID2)
     self.assertTrue(observed)
Beispiel #7
0
 def release(cls, context, stack_id, engine_id):
     return db_api.stack_lock_release(context, stack_id, engine_id)
Beispiel #8
0
 def release(cls, context, stack_id, engine_id):
     return db_api.stack_lock_release(context, stack_id, engine_id)