Skip multi GW router update if IP in use

Skip the test ``test_create_router_update_external_gateways`` execution
if the router gateway update returns a ``IpAddressAlreadyAllocated``
exception. That could happen if the removed gateway port IP, between
the removal and the re-assignation to the same router, is allocated by
other test, as reported in the bug. The probabilities of this error are
low but not zero.

Closes-Bug: #2117383
Signed-off-by: Rodolfo Alonso Hernandez <ralonsoh@redhat.com>
Change-Id: I8038c5775cf5f1c20a4349ddc472415b65945219
This commit is contained in:
Rodolfo Alonso Hernandez
2025-08-01 08:38:54 +00:00
parent 351046ec3b
commit 4ce01a2e18

View File

@@ -506,9 +506,17 @@ class ExternalGWMultihomingRoutersTest(base_routers.BaseRouterTest):
remove_gateways[0])
external_gateways[1] = remove_gateways[0]
res_update_gws = self.admin_client.router_update_external_gateways(
router['id'],
external_gateways)
try:
res_update_gws = self.admin_client.router_update_external_gateways(
router['id'],
external_gateways)
except lib_exc.Conflict as exc:
if 'IpAddressAlreadyAllocated' in str(exc):
self.skipTest(
'The IP address of the removed gateway port is already '
'used by other test, thus this exception is dismissed and '
'the rest of the test skipped')
raise exc
self.assertEqual(len(res_update_gws['router']['external_gateways']), 2)
for n in range(0, 2):