From 692e0f851796113b9cff0801a637f8d0855c4307 Mon Sep 17 00:00:00 2001 From: Assaf Muller Date: Mon, 12 Oct 2015 13:33:02 -0400 Subject: [PATCH] Remove useless code in L3 HA unit tests I added a helper function to make the server consider an agent as down, might as well use it! Change-Id: If1110de7f46ecb3dc2e72b3c62d7faeb0e71c586 --- neutron/tests/unit/db/test_l3_hamode_db.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/neutron/tests/unit/db/test_l3_hamode_db.py b/neutron/tests/unit/db/test_l3_hamode_db.py index 69a6826df..36712d9a4 100644 --- a/neutron/tests/unit/db/test_l3_hamode_db.py +++ b/neutron/tests/unit/db/test_l3_hamode_db.py @@ -12,10 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -import datetime import mock from oslo_config import cfg -from oslo_utils import timeutils from oslo_utils import uuidutils from neutron.api.rpc.handlers import l3_rpc @@ -62,13 +60,6 @@ class L3HATestFramework(testlib_api.SqlTestCase): self.agent2 = helpers.register_l3_agent( 'host_2', constants.L3_AGENT_MODE_DVR_SNAT) - def _bring_down_agent(self, agent_id): - update = { - 'agent': { - 'heartbeat_timestamp': - timeutils.utcnow() - datetime.timedelta(hours=1)}} - self.plugin.update_agent(self.admin_ctx, agent_id, update) - def _create_router(self, ha=True, tenant_id='tenant1', distributed=None, ctx=None): if ctx is None: @@ -497,8 +488,7 @@ class L3HATestCase(L3HATestFramework): def test_get_number_of_agents_for_scheduling_not_enough_agents(self): cfg.CONF.set_override('min_l3_agents_per_router', 3) - agent_to_bring_down = helpers.register_l3_agent(host='l3host_3') - self._bring_down_agent(agent_to_bring_down['id']) + helpers.kill_agent(helpers.register_l3_agent(host='l3host_3')['id']) self.assertRaises(l3_ext_ha_mode.HANotEnoughAvailableAgents, self.plugin.get_number_of_agents_for_scheduling, self.admin_ctx) -- 2.45.2