Nested commits in sqlalchemy should be seen as a single transaction on the
backend, shouldn't they?
I don't know anything about this specific problem, but the fact that unit
tests use sqlite might be a reason, since it's not really a full DBMS...

I think that wrapping tests in transaction also will require some changes
in the architecture of the tests themselves, as many tests call the API
router or the plugin which then gets a db session and open a new
transaction. Furthermore, it will change the test behaviour possibly hiding
errors; some operations indeed perform several distinct transactions, which
in this case will be seen a single transaction.

What Kevin is doing here I think was the original way we used to do that in
Neutron (Folsom). Then at some point we realised that due to plugin schema
differences we were laving tables behind and switched to drop_all and
rebuilding the schema using autogeneration at each test.

I think it should be ok to merge this patch. I will hold off the +A to give
other core reviewers a chance to look at it.

Salvatore


On 18 September 2014 11:44, Maru Newby <ma...@redhat.com> wrote:

> For legacy reasons, the Neutron test suite creates and destroys a db for
> each test.  There is a patch proposed to create the tables once and then
> ensure the tables are wiped at the end of each test [1], providing a
> performance improvement of ~10%.  I was wondering if this is the best way
> to provide isolation, since I’ve heard that isolation via per-test
> transactions should also work.  The patch author reported problems with
> this approach - apparently nested commits were not being rolled back.  Is
> there some trick to isolating with transactions that wouldn’t be
> immediately obvious?
>
> Thanks,
>
>
> Maru
>
> 1: https://review.openstack.org/#/c/122028/
> _______________________________________________
> OpenStack-dev mailing list
> OpenStack-dev@lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
_______________________________________________
OpenStack-dev mailing list
OpenStack-dev@lists.openstack.org
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

Reply via email to