'Test claim fails when worker was already claimed by this service.'

def test_worker_claim_fails_this_service_claimed(self):

    service_id = 1
    worker = db.worker_create(self.ctxt, resource_type='Volume', resource_id=fake.VOLUME_ID, status='creating', service_id=service_id)
    worker = db.worker_get(self.ctxt, id=worker.id)
    claimed_worker = db.worker_get(self.ctxt, id=worker.id)
    time.sleep(0.1)
    res = db.worker_claim_for_cleanup(self.ctxt, service_id, claimed_worker)
    self.assertEqual(1, res)
    res = db.worker_claim_for_cleanup(self.ctxt, service_id, worker)
    self.assertEqual(0, res)
    db_worker = db.worker_get(self.ctxt, id=worker.id)
    self._assertEqualObjects(claimed_worker, db_worker)
    self._assertEqualObjects(worker, db_worker, ['updated_at', 'race_preventer'])
    self.assertNotEqual(worker.updated_at, db_worker.updated_at)
    self.assertEqual((worker.race_preventer + 1), db_worker.race_preventer)
