Migrations tests aren't run for MySQL and PostgreSQL by Jenkins gate

Bug #1205386 reported by Roman Podoliaka on 2013-07-26
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Ivan Kolodyazhny

Bug Description

Database schema migrations tests aren't run for MySQL and PostgreSQL backends by Jenkins gate. This is due to the bug in _get_connect_string() function:

def _get_connect_string(backend,
    Try to get a connection with a very specific set of values, if we get
    these then we'll run the tests, otherwise they are skipped
    if backend == "postgres":
        backend = "postgresql+psycopg2"

    return ("%(backend)s://%(user)s:%(passwd)s@localhost/%(database)s",
            {'backend': backend, 'user': user, 'passwd': passwd,
             'database': database})

This function is supposed to return a database connection string, but % operator is missed, so a tuple will be returned instead. The return value is used in _is_backend_avail() function:

def _is_backend_avail(backend,
        if backend == "mysql":
            connect_uri = _get_connect_string("mysql", user=user,
                                              passwd=passwd, database=database)
        elif backend == "postgres":
            connect_uri = _get_connect_string("postgres", user=user,
                                              passwd=passwd, database=database)
        engine = sqlalchemy.create_engine(connect_uri)
        connection = engine.connect()
    except Exception:
        # intentionally catch all to handle exceptions even if we don't
        # have any backend code loaded.
        return False
        return True

_is_backend_avail() excepts a too general exception, so the actual error is interpreted incorrectly (as if a DB backend wasn't available), so the test is skipped.

The regression was introduced in 729a08a019837bf4a5cbce5eee46a0a6e8e12acd.

Changed in cinder:
assignee: nobody → Roman Podolyaka (rpodolyaka)

Fix proposed to branch: master
Review: https://review.openstack.org/38826

Changed in cinder:
status: New → In Progress

Reviewed: https://review.openstack.org/38826
Committed: http://github.com/openstack/cinder/commit/475f06909388a974c9dd52b8d9d1f856f81a1155
Submitter: Jenkins
Branch: master

commit 475f06909388a974c9dd52b8d9d1f856f81a1155
Author: Roman Podolyaka <email address hidden>
Date: Fri Jul 26 18:44:19 2013 +0300

    Fix running of migrations tests by Jenkins gate

    DB schema migrations tests are always skipped for MySQL
    and PostgreSQL backends, when running gate jobs. This is
    due to the bug in the function, which checks, if given DB
    backend is available.

    Fixes bug 1205386

    Change-Id: I80d5da64347279b8fb5a975ff0d11f31fe35c6ce

Changed in cinder:
status: In Progress → Fix Committed
Thierry Carrez (ttx) on 2013-09-05
Changed in cinder:
milestone: none → havana-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2013-10-17
Changed in cinder:
milestone: havana-3 → 2013.2
Ivan Kolodyazhny (e0ne) on 2016-12-26
Changed in cinder:
status: Fix Released → Confirmed

Fix proposed to branch: master
Review: https://review.openstack.org/415012

Changed in cinder:
assignee: Roman Podoliaka (rpodolyaka) → Ivan Kolodyazhny (e0ne)
status: Confirmed → In Progress

Reviewed: https://review.openstack.org/415012
Committed: https://git.openstack.org/cgit/openstack/cinder/commit/?id=193d91282a7e95160a8dc40a5482c0243192cfe9
Submitter: Jenkins
Branch: master

commit 193d91282a7e95160a8dc40a5482c0243192cfe9
Author: Ivan Kolodyazhny <email address hidden>
Date: Mon Dec 26 17:50:55 2016 +0200

    Add psycopg2 and PyMySQL to test-requirements

    Both PyMySQL and psycopg2 are needed to test migration scripts on gates.

    Change-Id: If75f15ebecb76d292839a07d36d1193e4781355d
    Closes-Bug: #1205386

Changed in cinder:
status: In Progress → Fix Released

This issue was fixed in the openstack/cinder development milestone.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers