Exemple #1
0
 def test_destroy_with_not_equal_constraint_met(self):
     ctx = context.get_admin_context()
     instance = db.instance_create(ctx, {'task_state': 'deleting'})
     constraint = db.constraint(task_state=db.not_equal('error', 'resize'))
     db.instance_destroy(ctx, instance['uuid'], constraint)
     self.assertRaises(exception.InstanceNotFound, db.instance_get_by_uuid,
                       ctx, instance['uuid'])
Exemple #2
0
 def test_destroy_with_not_equal_constraint_met(self):
     ctx = context.get_admin_context()
     instance = db.instance_create(ctx, {'task_state': 'deleting'})
     constraint = db.constraint(task_state=db.not_equal('error', 'resize'))
     db.instance_destroy(ctx, instance['uuid'], constraint)
     self.assertRaises(exception.InstanceNotFound, db.instance_get_by_uuid,
                       ctx, instance['uuid'])
Exemple #3
0
 def test_destroy_with_not_equal_constraint_not_met(self):
     ctx = context.get_admin_context()
     instance = db.instance_create(ctx, {"vm_state": "active"})
     constraint = db.constraint(vm_state=db.not_equal("active", "error"))
     self.assertRaises(exception.ConstraintNotMet, db.instance_destroy, ctx, instance["uuid"], constraint)
     instance = db.instance_get_by_uuid(ctx, instance["uuid"])
     self.assertFalse(instance["deleted"])
Exemple #4
0
 def test_destroy_with_not_equal_constraint_not_met(self):
     ctx = context.get_admin_context()
     instance = db.instance_create(ctx, {'vm_state': 'active'})
     constraint = db.constraint(vm_state=db.not_equal('active', 'error'))
     self.assertRaises(exception.ConstraintNotMet, db.instance_destroy,
                       ctx, instance['uuid'], constraint)
     instance = db.instance_get_by_uuid(ctx, instance['uuid'])
     self.assertFalse(instance['deleted'])
Exemple #5
0
 def test_destroy_with_not_equal_constraint_not_met(self):
     ctx = context.get_admin_context()
     instance = db.instance_create(ctx, {'vm_state': 'active'})
     constraint = db.constraint(vm_state=db.not_equal('active', 'error'))
     self.assertRaises(exception.ConstraintNotMet, db.instance_destroy, ctx,
                       instance['uuid'], constraint)
     instance = db.instance_get_by_uuid(ctx, instance['uuid'])
     self.assertFalse(instance['deleted'])
Exemple #6
0
 def test_destroy_with_not_equal_constraint_met(self):
     ctx = context.get_admin_context()
     instance = db.instance_create(ctx, {"task_state": "deleting"})
     constraint = db.constraint(task_state=db.not_equal("error", "resize"))
     db.instance_destroy(ctx, instance["uuid"], constraint)
     self.assertRaises(exception.InstanceNotFound, db.instance_get_by_uuid, ctx, instance["uuid"])