]> 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)
committerThomas Goirand <thomas@goirand.fr>
Thu, 13 Mar 2014 07:20:26 +0000 (15:20 +0800)
commitd424f5bf02cd571b7c1efa69574f0d307fcbebc5
tree5621a0494a6d0138ff2855646bcafb1b9247839e
parent0b0a39dca1b0a8b186bacf93d2fbfff3e7cd859c
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