commit 2e12e4b7a8a39397f56a290ee8113d7607d7f46b
Author: Victor Sergeyev <email address hidden>
Date: Thu Jun 12 13:02:10 2014 +0300
Sync "Prevent races in opportunistic db test cases"
This sync change Id82090743e8b93f6c960de066fd05d8a2f9fb934 from
oslo-incubator
Opportunistic db test cases create schemas on demand, so that each
test case which inherits the base test case class, will get its own
db schema (i. e. races between tests are not possible).
In order to do schema provisioning we have to connect to RDBMS server
first. So far we've been connecting to the openstack_citest database,
which is guaranteed to exist on CI nodes. It turns out, there are a
few test cases in Nova (maybe in other projects as well), that drop
and recreate the openstack_citest database. If they happen to do that
when the opportunistic db fixture is in the middle of provisioning a
schema, those tests will fail (as there is an open session to the
database and thus it can't be dropped).
This can be solved easily by changing the way we provision new
schemas in opportunistic db test cases as actually, we don't have to
connect to the openstack_citest database at all:
- for MySQL we can use an empty db name to connect to MySQL server,
but not to a particular database
- PostgreSQL requires us to specify the database name. We can use
the service postgres database here (PostgreSQL shell utils such
as createdb, createuser, etc use it for the very same reason)
Reviewed: https:/ /review. openstack. org/99614 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=2e12e4b7a8a 39397f56a290ee8 113d7607d7f46b
Committed: https:/
Submitter: Jenkins
Branch: master
commit 2e12e4b7a8a3939 7f56a290ee8113d 7607d7f46b
Author: Victor Sergeyev <email address hidden>
Date: Thu Jun 12 13:02:10 2014 +0300
Sync "Prevent races in opportunistic db test cases"
This sync change Id82090743e8b93 f6c960de066fd05 d8a2f9fb934 from
oslo-incubator
Opportunistic db test cases create schemas on demand, so that each
test case which inherits the base test case class, will get its own
db schema (i. e. races between tests are not possible).
In order to do schema provisioning we have to connect to RDBMS server
first. So far we've been connecting to the openstack_citest database,
which is guaranteed to exist on CI nodes. It turns out, there are a
few test cases in Nova (maybe in other projects as well), that drop
and recreate the openstack_citest database. If they happen to do that
when the opportunistic db fixture is in the middle of provisioning a
schema, those tests will fail (as there is an open session to the
database and thus it can't be dropped).
This can be solved easily by changing the way we provision new
schemas in opportunistic db test cases as actually, we don't have to
connect to the openstack_citest database at all:
- for MySQL we can use an empty db name to connect to MySQL server,
but not to a particular database
- PostgreSQL requires us to specify the database name. We can use
the service postgres database here (PostgreSQL shell utils such
as createdb, createuser, etc use it for the very same reason)
Partial-Bug: #1328997
Change-Id: Idc62b24b6ae51e a14f10e39d7b141 15e36069637