[UT] Mock the retry decorator when creating duplicated NDPProxy

The test ``test_create_ndp_proxy_with_duplicated`` was correctly testing
the creation of a duplicated NDPProxy object. However it was taking
around 3 minutes because the decorator ``oslo_db_api.wrap_db_retry``
was retrying the object creation several times. This patch mocks the
retry decorator; now the test takes around 6 seconds.

Closes-Bug: #2007254
Change-Id: I2fcad691df4a7ae112e1d55fefe662016430aa5b
This commit is contained in:
Rodolfo Alonso Hernandez 2023-02-14 04:40:15 +01:00 committed by Rodolfo Alonso
parent e2f273f093
commit 0bbab95265
1 changed files with 4 additions and 0 deletions

View File

@ -23,6 +23,7 @@ from neutron_lib.api.definitions import l3 as l3_apidef
from neutron_lib.api.definitions import l3_ext_gw_mode
from neutron_lib import constants
from neutron_lib import context
from neutron_lib import fixture
from oslo_config import cfg
from oslo_utils import uuidutils
from webob import exc
@ -566,6 +567,9 @@ class L3NDPProxyTestCase(test_address_scope.AddressScopeTestCase,
def test_create_ndp_proxy_with_duplicated(self):
with self.port(self.private_subnet) as port1:
self._create_ndp_proxy(self.router1_id, port1['port']['id'])
retry_fixture = fixture.DBRetryErrorsFixture(max_retries=1)
retry_fixture.setUp()
self._create_ndp_proxy(
self.router1_id, port1['port']['id'],
expected_code=exc.HTTPConflict.code)
retry_fixture.cleanUp()