Test Nova

apt-get update
git clone git://anonscm.debian.org/openstack/nova.git
cd nova
git checkout -b debian/havana origin/debian/havana
apt-get build-dep nova
# make sure that testtools and subunit Python modules are installed
# make sure that python-migration 0.8.5 is installed
# apt-cache policy python-migrate
apt-get install fakeroot git-buildpackage
./debian/rules gen-orig-xz
git-buildpackage -uc -us

To just run tests:

./run_tests.sh -N -P

Or to run a single test:

./run_tests.sh -N -P test_name

Note: tests are executed with SQLite.

Example of errors:

DBError: (IntegrityError) CHECK constraint failed: reservations u'UPDATE reservations SET updated_at=updated_at, deleted_at=?, deleted=id WHERE reservations.deleted = ? AND reservations.uuid IN (?, ?, ?)' ('2014-03-06 12:20:30.067063', 0, '8a308917-b71a-4057-ab60-84815f9a4067', '6bd69e08-b573-4587-9f98-0677f0c15814', '28401e30-79b6-4113-86f7-13d7c981a640')


Dump schema of a table in SQLite, columns and constraints:

SELECT sql FROM sqlite_master WHERE type='table' and name='reservations';


PRAGMA table_info(reservations);

Execute a query in the SQLite database which is only stored in memory: set a break point on the error using gdb, and then type:

pp next(iter(self.query.session.transaction._connections.values()))[0].connection.execute("pragma table_info(reservations);").fetchall()

Reservation table in Havana with the bug:

CREATE TABLE "reservations" (
        created_at DATETIME, 
        updated_at DATETIME, 
        deleted_at DATETIME, 
        deleted INTEGER, 
        id INTEGER NOT NULL, 
        uuid VARCHAR(36) NOT NULL, 
        usage_id INTEGER NOT NULL, 
        project_id VARCHAR(255), 
        resource VARCHAR(255), 
        delta INTEGER NOT NULL, 
        expire DATETIME, user_id VARCHAR(255), 
        PRIMARY KEY (id), 
        CHECK (deleted IN (0, 1))