Esempio n. 1
0
 def test_destroy_container_by_uuid(self):
     container = utils.create_test_container(context=self.context)
     dbapi.destroy_container(self.context, container.container_type,
                             container.uuid)
     self.assertRaises(exception.ContainerNotFound,
                       dbapi.get_container_by_uuid, self.context,
                       container.container_type, container.uuid)
Esempio n. 2
0
 def test_destroy_container(self, mock_delete, mock_write, mock_read):
     mock_read.side_effect = etcd.EtcdKeyNotFound
     container = utils.create_test_container(context=self.context)
     mock_read.side_effect = lambda *args: FakeEtcdResult(container.as_dict(
     ))
     dbapi.destroy_container(self.context, container.uuid)
     mock_delete.assert_called_once_with('/containers/%s' % container.uuid)
Esempio n. 3
0
 def test_destroy_container_by_uuid(self):
     container = utils.create_test_container(context=self.context)
     dbapi.destroy_container(self.context, container.container_type,
                             container.uuid)
     self.assertRaises(exception.ContainerNotFound,
                       dbapi.get_container_by_uuid,
                       self.context, container.container_type,
                       container.uuid)
Esempio n. 4
0
    def destroy(self, context=None):
        """Delete the Container from the DB.

        :param context: Security context. NOTE: This should only
                        be used internally by the indirection_api.
                        Unfortunately, RPC requires context as the first
                        argument, even though we don't use it.
                        A context should be set when instantiating the
                        object, e.g.: Container(context)
        """
        dbapi.destroy_container(context, self.container_type, self.uuid)
        self.obj_reset_changes()
Esempio n. 5
0
    def destroy(self, context=None):
        """Delete the Container from the DB.

        :param context: Security context. NOTE: This should only
                        be used internally by the indirection_api.
                        Unfortunately, RPC requires context as the first
                        argument, even though we don't use it.
                        A context should be set when instantiating the
                        object, e.g.: Container(context)
        """
        dbapi.destroy_container(context, self.container_type, self.uuid)
        self.obj_reset_changes()