Exemplo n.º 1
0
 def _deleted_stack_existance(self, ctx, stacks, existing, deleted):
     for s in existing:
         self.assertIsNotNone(
             db_api.stack_get(ctx, stacks[s].id, show_deleted=True))
     for s in deleted:
         self.assertIsNone(
             db_api.stack_get(ctx, stacks[s].id, show_deleted=True))
Exemplo n.º 2
0
 def _deleted_stack_existance(self, ctx, stacks, existing, deleted):
     for s in existing:
         self.assertIsNotNone(db_api.stack_get(ctx, stacks[s].id,
                                               show_deleted=True))
     for s in deleted:
         self.assertIsNone(db_api.stack_get(ctx, stacks[s].id,
                                            show_deleted=True))
Exemplo n.º 3
0
    def test_stack_get(self):
        stack = self._setup_test_stack('stack', UUID1)[1]

        st = db_api.stack_get(self.ctx, UUID1, show_deleted=False)
        self.assertEqual(UUID1, st.id)

        stack.delete()
        st = db_api.stack_get(self.ctx, UUID1, show_deleted=False)
        self.assertIsNone(st)

        st = db_api.stack_get(self.ctx, UUID1, show_deleted=True)
        self.assertEqual(UUID1, st.id)
Exemplo n.º 4
0
    def test_stack_get(self):
        stack = self._setup_test_stack('stack', UUID1)[1]

        st = db_api.stack_get(self.ctx, UUID1, show_deleted=False)
        self.assertEqual(UUID1, st.id)

        stack.delete()
        st = db_api.stack_get(self.ctx, UUID1, show_deleted=False)
        self.assertIsNone(st)

        st = db_api.stack_get(self.ctx, UUID1, show_deleted=True)
        self.assertEqual(UUID1, st.id)
Exemplo n.º 5
0
    def test_stack_get(self):
        stack = create_stack(self.ctx, self.template, self.user_creds)
        ret_stack = db_api.stack_get(self.ctx, stack.id, False, False)
        self.assertIsNotNone(ret_stack)
        self.assertEqual(stack.id, ret_stack.id)
        self.assertEqual('db_test_stack_name', ret_stack.name)

        self.assertIsNone(db_api.stack_get(self.ctx, UUID1, False, False))

        self.ctx.tenant_id = 'abc'
        self.assertIsNone(db_api.stack_get(self.ctx, stack.id, False, False))

        ret_stack = db_api.stack_get(self.ctx, stack.id, True, False)
        self.assertEqual(stack.id, ret_stack.id)
        self.assertEqual('db_test_stack_name', ret_stack.name)
Exemplo n.º 6
0
    def test_stack_get(self):
        stack = create_stack(self.ctx, self.template, self.user_creds)
        ret_stack = db_api.stack_get(self.ctx, stack.id, False, False)
        self.assertIsNotNone(ret_stack)
        self.assertEqual(stack.id, ret_stack.id)
        self.assertEqual('db_test_stack_name', ret_stack.name)

        self.assertIsNone(db_api.stack_get(self.ctx, UUID1, False, False))

        self.ctx.tenant_id = 'abc'
        self.assertIsNone(db_api.stack_get(self.ctx, stack.id, False, False))

        ret_stack = db_api.stack_get(self.ctx, stack.id, True, False)
        self.assertEqual(stack.id, ret_stack.id)
        self.assertEqual('db_test_stack_name', ret_stack.name)
Exemplo n.º 7
0
 def test_stack_get_can_return_a_stack_from_different_tenant(self):
     stack = create_stack(self.ctx, self.template, self.user_creds)
     self.ctx.tenant_id = 'abc'
     ret_stack = db_api.stack_get(self.ctx, stack.id,
                                  show_deleted=False, tenant_safe=False)
     self.assertEqual(stack.id, ret_stack.id)
     self.assertEqual('db_test_stack_name', ret_stack.name)
Exemplo n.º 8
0
 def test_stack_get_can_return_a_stack_from_different_tenant(self):
     stack = create_stack(self.ctx, self.template, self.user_creds)
     self.ctx.tenant_id = 'abc'
     ret_stack = db_api.stack_get(self.ctx, stack.id,
                                  show_deleted=False, tenant_safe=False)
     self.assertEqual(stack.id, ret_stack.id)
     self.assertEqual('db_test_stack_name', ret_stack.name)
Exemplo n.º 9
0
Arquivo: stack.py Projeto: aaratn/heat
 def refresh(self):
     db_stack = db_api.stack_get(
         self._context, self.id, show_deleted=True)
     if db_stack is None:
         message = _('No stack exists with id "%s"') % str(self.id)
         raise exception.NotFound(message)
     return self.__class__._from_db_object(
         self._context,
         self,
         db_stack
     )
Exemplo n.º 10
0
 def refresh(self):
     db_stack = db_api.stack_get(
         self._context, self.id, show_deleted=True)
     if db_stack is None:
         message = _('No stack exists with id "%s"') % str(self.id)
         raise exception.NotFound(message)
     return self.__class__._from_db_object(
         self._context,
         self,
         db_stack
     )
Exemplo n.º 11
0
    def test_stack_delete(self):
        stack = create_stack(self.ctx, self.template, self.user_creds)
        stack_id = stack.id
        resource = create_resource(self.ctx, stack)
        db_api.stack_delete(self.ctx, stack_id)
        self.assertIsNone(db_api.stack_get(self.ctx, stack_id, False, False))
        self.assertRaises(exception.NotFound, db_api.resource_get, self.ctx,
                          resource.id)

        self.assertRaises(exception.NotFound, db_api.stack_delete, self.ctx,
                          stack_id)

        #Testing soft delete
        ret_stack = db_api.stack_get(self.ctx, stack_id, False, True)
        self.assertIsNotNone(ret_stack)
        self.assertEqual(stack_id, ret_stack.id)
        self.assertEqual('db_test_stack_name', ret_stack.name)

        #Testing child resources deletion
        self.assertRaises(exception.NotFound, db_api.resource_get, self.ctx,
                          resource.id)
Exemplo n.º 12
0
    def test_stack_delete(self):
        stack = create_stack(self.ctx, self.template, self.user_creds)
        stack_id = stack.id
        resource = create_resource(self.ctx, stack)
        db_api.stack_delete(self.ctx, stack_id)
        self.assertIsNone(db_api.stack_get(self.ctx, stack_id, False, False))
        self.assertRaises(exception.NotFound, db_api.resource_get,
                          self.ctx, resource.id)

        self.assertRaises(exception.NotFound, db_api.stack_delete,
                          self.ctx, stack_id)

        #Testing soft delete
        ret_stack = db_api.stack_get(self.ctx, stack_id, False, True)
        self.assertIsNotNone(ret_stack)
        self.assertEqual(stack_id, ret_stack.id)
        self.assertEqual('db_test_stack_name', ret_stack.name)

        #Testing child resources deletion
        self.assertRaises(exception.NotFound, db_api.resource_get,
                          self.ctx, resource.id)
Exemplo n.º 13
0
    def test_stack_update(self):
        stack = create_stack(self.ctx, self.template, self.user_creds)
        values = {
            'name': 'db_test_stack_name2',
            'action': 'update',
            'status': 'failed',
            'status_reason': "update_failed",
            'timeout': '90',
        }
        db_api.stack_update(self.ctx, stack.id, values)
        stack = db_api.stack_get(self.ctx, stack.id)
        self.assertEqual('db_test_stack_name2', stack.name)
        self.assertEqual('update', stack.action)
        self.assertEqual('failed', stack.status)
        self.assertEqual('update_failed', stack.status_reason)
        self.assertEqual('90', stack.timeout)

        self.assertRaises(exception.NotFound, db_api.stack_update, self.ctx,
                          UUID2, values)
Exemplo n.º 14
0
    def test_stack_update(self):
        stack = create_stack(self.ctx, self.template, self.user_creds)
        values = {
            'name': 'db_test_stack_name2',
            'action': 'update',
            'status': 'failed',
            'status_reason': "update_failed",
            'timeout': '90',
        }
        db_api.stack_update(self.ctx, stack.id, values)
        stack = db_api.stack_get(self.ctx, stack.id)
        self.assertEqual('db_test_stack_name2', stack.name)
        self.assertEqual('update', stack.action)
        self.assertEqual('failed', stack.status)
        self.assertEqual('update_failed', stack.status_reason)
        self.assertEqual('90', stack.timeout)

        self.assertRaises(exception.NotFound, db_api.stack_update, self.ctx,
                          UUID2, values)
Exemplo n.º 15
0
 def test_stack_get_returns_none_if_stack_does_not_exist(self):
     stack = db_api.stack_get(self.ctx, UUID1, show_deleted=False)
     self.assertIsNone(stack)
Exemplo n.º 16
0
 def test_stack_get_returns_none_if_tenant_id_does_not_match(self):
     stack = create_stack(self.ctx, self.template, self.user_creds)
     self.ctx.tenant_id = 'abc'
     stack = db_api.stack_get(self.ctx, UUID1, show_deleted=False)
     self.assertIsNone(stack)
Exemplo n.º 17
0
Arquivo: stack.py Projeto: aaratn/heat
 def get_by_id(cls, context, stack_id, **kwargs):
     db_stack = db_api.stack_get(context, stack_id, **kwargs)
     if not db_stack:
         return None
     stack = cls._from_db_object(context, cls(context), db_stack)
     return stack
Exemplo n.º 18
0
 def test_stack_get_returns_none_if_tenant_id_does_not_match(self):
     stack = create_stack(self.ctx, self.template, self.user_creds)
     self.ctx.tenant_id = 'abc'
     stack = db_api.stack_get(self.ctx, UUID1, show_deleted=False)
     self.assertIsNone(stack)
Exemplo n.º 19
0
 def test_stack_get_returns_none_if_stack_does_not_exist(self):
     stack = db_api.stack_get(self.ctx, UUID1, show_deleted=False)
     self.assertIsNone(stack)
Exemplo n.º 20
0
 def get_by_id(cls, context, stack_id, **kwargs):
     db_stack = db_api.stack_get(context, stack_id, **kwargs)
     if not db_stack:
         return None
     stack = cls._from_db_object(context, cls(context), db_stack)
     return stack
Exemplo n.º 21
0
 def test_stack_get_returns_a_stack(self):
     stack = create_stack(self.ctx, self.template, self.user_creds)
     ret_stack = db_api.stack_get(self.ctx, stack.id, show_deleted=False)
     self.assertIsNotNone(ret_stack)
     self.assertEqual(stack.id, ret_stack.id)
     self.assertEqual('db_test_stack_name', ret_stack.name)
Exemplo n.º 22
0
 def test_stack_get_returns_a_stack(self):
     stack = create_stack(self.ctx, self.template, self.user_creds)
     ret_stack = db_api.stack_get(self.ctx, stack.id, show_deleted=False)
     self.assertIsNotNone(ret_stack)
     self.assertEqual(stack.id, ret_stack.id)
     self.assertEqual('db_test_stack_name', ret_stack.name)