]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commit
Use different context for each API request in unit tests
authorSalvatore Orlando <salv.orlando@gmail.com>
Fri, 14 Feb 2014 16:17:30 +0000 (08:17 -0800)
committerSalvatore Orlando <salv.orlando@gmail.com>
Fri, 21 Feb 2014 00:58:39 +0000 (16:58 -0800)
commitfcad26e394cd6021aab2c94f1179533cc7866f8c
tree1112431ae14748b87bcf45fd2875f213af8371ff
parentb70dce2aab5b1c496786d4258a93f3c7ea3dc267
Use different context for each API request in unit tests

test_router_add_interface_subnet_with_port_from_other_tenant in
neutron.tests.unit.test_l3_plugin.L3NatTestCaseBase was mocking
neutron.context.Context thus performing multiple API requests
with the same context instance. As a context instance also has
a DB session attribute, this might cause unexpected side effects,
especially for plugins which process request asynchronously.

The plugin neutron.plugins.nicira.NeutronServicePlugin was being
affected.

This patch ensures each request has a different context object
without changing the unit test semantics.

It also refactors slightly test_edge_router.py in the nicira
unit test package to avoid executing twice the same unit tests.

Change-Id: I4895faa00ebd915eb9e259930db2d004a9e78a86
Closes-Bug: #1280035
neutron/tests/unit/nicira/test_edge_router.py
neutron/tests/unit/test_l3_plugin.py