Accept both error 400 and 500 in the vlan_transparent unit tests

Error code returned from the Neutron when attempt to create network with
enabled 'vlan_transparent' has changed with [1] from 500 to 400. The
unit test which checks this has to be adjusted as well. For now, test
needs to accept both return codes as patch which changes that is in
neutron-lib and we would have "checkien and egg" issue with merging both
patches otherwise.

[1] https://review.opendev.org/c/openstack/neutron-lib/+/937605

Related-Bug: #2091613
Change-Id: Ic53b191ecfd11d71f85251a777bc0c7da4463a06
This commit is contained in:
Slawek Kaplonski 2024-12-13 09:28:26 +01:00
parent 36cc7f7cbb
commit ea5a8d3123

View File

@ -694,7 +694,11 @@ class TestMl2NetworksWithVlanTransparency(
network_req = self.new_create_request(
'networks', self.data, as_admin=True)
res = network_req.get_response(self.api)
self.assertEqual(500, res.status_int)
# NOTE(slaweq): if neutron-lib <= 3.16.0 is used it will return
# errot 500 but starting from 3.17 it returns error
# code 400 (Bad request). This was changed with patch
# https://review.opendev.org/c/openstack/neutron-lib/+/937605
self.assertIn(res.status_int, [400, 500])
error_result = self.deserialize(self.fmt, res)['NeutronError']
self.assertEqual("VlanTransparencyDriverError",
error_result['type'])