Example #1
0

def setUpModule():
    """Stub in get_db and reset_db for testing the simple db api."""
    base.db_api = qonos.db.sqlalchemy.api
    base.db_api.configure_db()


def tearDownModule():
    """Reset get_db and reset_db for cleanliness."""
    base.db_api = None


#NOTE(ameade): Pull in cross driver db tests
thismodule = sys.modules[__name__]
utils.import_test_cases(thismodule, base, suffix="_Sqlalchemy_DB")


class TestSQLAlchemyOptimisticLocking(base.TestJobsDBGetNextJobApi):

    def _setup_db_api_log_fixture(self, stream):
        db_api_log = logging.getLogger('qonos.db.sqlalchemy.api')
        db_api_log.setLevel(logging.WARN)
        handler = logging.StreamHandler(stream)
        handler.setFormatter(logging.Formatter('%(message)s'))
        db_api_log.addHandler(handler)

        self.addCleanup(db_api_log.removeHandler, handler)

    def _prepare_same_job_for_workers(self, job_id):
        same_job_ref_1 = base.db_api._job_get_by_id(job_id)
Example #2
0
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

import sys

import qonos.db.simple.api
from qonos.tests.functional.db import base
from qonos.tests import utils


def setUpModule():
    """Stub in get_db and reset_db for testing the simple db api."""
    base.db_api = qonos.db.simple.api


def tearDownModule():
    """Reset get_db and reset_db for cleanliness."""
    base.db_api = None


#NOTE(ameade): Pull in cross driver db tests
thismodule = sys.modules[__name__]
utils.import_test_cases(thismodule, base, suffix="_Simple_DB")
Example #3
0
import sys

from qonos.openstack.common import cfg
from qonos.tests import utils as utils
from qonos.tests.functional.v1 import base

CONF = cfg.CONF


def setUpModule():
    CONF.db_api = 'qonos.db.simple.api'


def tearDownModule():
    CONF.db_api = None


module = sys.modules[__name__]
utils.import_test_cases(module, base, suffix="_Simple_DB")
Example #4
0

def setUpModule():
    """Stub in get_db and reset_db for testing the simple db api."""
    base.db_api = qonos.db.sqlalchemy.api
    base.db_api.configure_db()


def tearDownModule():
    """Reset get_db and reset_db for cleanliness."""
    base.db_api = None


# NOTE(ameade): Pull in cross driver db tests
thismodule = sys.modules[__name__]
utils.import_test_cases(thismodule, base, suffix="_Sqlalchemy_DB")


class TestSQLAlchemyOptimisticLocking(base.TestJobsDBGetNextJobApi):
    def _setup_db_api_log_fixture(self, stream):
        db_api_log = logging.getLogger('qonos.db.sqlalchemy.api')
        db_api_log.setLevel(logging.WARN)
        handler = logging.StreamHandler(stream)
        handler.setFormatter(logging.Formatter('%(message)s'))
        db_api_log.addHandler(handler)

        self.addCleanup(db_api_log.removeHandler, handler)

    def _prepare_same_job_for_workers(self, job_id):
        same_job_ref_1 = base.db_api._job_get_by_id(job_id)
        same_job_ref_2 = base.db_api._job_get_by_id(job_id)