From 44b966837da4c4ce64eb5d02579ada65f062ac01 Mon Sep 17 00:00:00 2001 From: Isaku Yamahata Date: Wed, 14 Feb 2018 23:25:40 -0800 Subject: [PATCH] l3: an unit test for set_extra_attr_value Add an unit test for set_extra_attr_value to check if exception is raised when it's called out of db transaction. This patch is follow up for I0e2707222b1f91199cf466c997c0e691679fd3a4 Change-Id: I1c9bdf88ceba8ac07c8501b2f5590bc6adc6c337 Partial-bug: #1745633 --- neutron/tests/unit/extensions/test_l3.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/neutron/tests/unit/extensions/test_l3.py b/neutron/tests/unit/extensions/test_l3.py index 85b79f5bf80..cd2b13b18bb 100644 --- a/neutron/tests/unit/extensions/test_l3.py +++ b/neutron/tests/unit/extensions/test_l3.py @@ -581,6 +581,11 @@ class ExtraAttributesMixinTestCase(testlib_api.SqlTestCase): self.mixin.set_extra_attr_value(self.ctx, self.router, 'bad', 'value') + def test_set_attrs_and_extend_no_transaction(self): + with testtools.ExpectedException(RuntimeError): + self.mixin.set_extra_attr_value(self.ctx, self.router, + 'ha_vr_id', 99) + def test__extend_extra_router_dict_defaults(self): rdict = {} self.mixin._extend_extra_router_dict(rdict, self.router)