From ea5a8d31238b25e757b9ffdbbb941b9189616f48 Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Fri, 13 Dec 2024 09:28:26 +0100 Subject: [PATCH] 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 --- neutron/tests/unit/plugins/ml2/test_plugin.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/neutron/tests/unit/plugins/ml2/test_plugin.py b/neutron/tests/unit/plugins/ml2/test_plugin.py index 042075e93b8..2af9ae1657b 100644 --- a/neutron/tests/unit/plugins/ml2/test_plugin.py +++ b/neutron/tests/unit/plugins/ml2/test_plugin.py @@ -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'])