From fed9c30b984fa69a048bc1672362e40c2fe0ad6c Mon Sep 17 00:00:00 2001 From: Assaf Muller Date: Mon, 6 Apr 2015 23:56:15 -0400 Subject: [PATCH] Remove tests from HA routers test framework The framework class should not contain tests. Running the module was running an additional 9 tests that should not have been run. Change-Id: Iabc6367e8bfda18e395d1a19809b07507200003d --- neutron/tests/unit/db/test_l3_hamode_db.py | 60 +++++++++++----------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/neutron/tests/unit/db/test_l3_hamode_db.py b/neutron/tests/unit/db/test_l3_hamode_db.py index d2aaea600..18a7392ad 100644 --- a/neutron/tests/unit/db/test_l3_hamode_db.py +++ b/neutron/tests/unit/db/test_l3_hamode_db.py @@ -100,36 +100,6 @@ class L3HATestFramework(testlib_api.SqlTestCase): router_id, agents_db) - def test_get_ha_router_port_bindings(self): - router = self._create_router() - self._bind_router(router['id']) - bindings = self.plugin.get_ha_router_port_bindings( - self.admin_ctx, [router['id']]) - binding_dicts = [{'router_id': binding['router_id'], - 'l3_agent_id': binding['l3_agent_id']} - for binding in bindings] - self.assertIn({'router_id': router['id'], - 'l3_agent_id': self.agent1['id']}, binding_dicts) - self.assertIn({'router_id': router['id'], - 'l3_agent_id': self.agent2['id']}, binding_dicts) - - def test_get_l3_bindings_hosting_router_with_ha_states_ha_router(self): - router = self._create_router() - self._bind_router(router['id']) - self.plugin.update_routers_states( - self.admin_ctx, {router['id']: 'active'}, self.agent1['host']) - bindings = self.plugin.get_l3_bindings_hosting_router_with_ha_states( - self.admin_ctx, router['id']) - agent_ids = [(agent[0]['id'], agent[1]) for agent in bindings] - self.assertIn((self.agent1['id'], 'active'), agent_ids) - self.assertIn((self.agent2['id'], 'standby'), agent_ids) - - def test_get_l3_bindings_hosting_router_with_ha_states_not_scheduled(self): - router = self._create_router(ha=False) - bindings = self.plugin.get_l3_bindings_hosting_router_with_ha_states( - self.admin_ctx, router['id']) - self.assertEqual([], bindings) - class L3HATestCase(L3HATestFramework): def test_verify_configuration_succeed(self): @@ -166,6 +136,36 @@ class L3HATestCase(L3HATestFramework): l3_hamode_db.UNLIMITED_AGENTS_PER_ROUTER) self.plugin._check_num_agents_per_router() + def test_get_ha_router_port_bindings(self): + router = self._create_router() + self._bind_router(router['id']) + bindings = self.plugin.get_ha_router_port_bindings( + self.admin_ctx, [router['id']]) + binding_dicts = [{'router_id': binding['router_id'], + 'l3_agent_id': binding['l3_agent_id']} + for binding in bindings] + self.assertIn({'router_id': router['id'], + 'l3_agent_id': self.agent1['id']}, binding_dicts) + self.assertIn({'router_id': router['id'], + 'l3_agent_id': self.agent2['id']}, binding_dicts) + + def test_get_l3_bindings_hosting_router_with_ha_states_ha_router(self): + router = self._create_router() + self._bind_router(router['id']) + self.plugin.update_routers_states( + self.admin_ctx, {router['id']: 'active'}, self.agent1['host']) + bindings = self.plugin.get_l3_bindings_hosting_router_with_ha_states( + self.admin_ctx, router['id']) + agent_ids = [(agent[0]['id'], agent[1]) for agent in bindings] + self.assertIn((self.agent1['id'], 'active'), agent_ids) + self.assertIn((self.agent2['id'], 'standby'), agent_ids) + + def test_get_l3_bindings_hosting_router_with_ha_states_not_scheduled(self): + router = self._create_router(ha=False) + bindings = self.plugin.get_l3_bindings_hosting_router_with_ha_states( + self.admin_ctx, router['id']) + self.assertEqual([], bindings) + def test_ha_router_create(self): router = self._create_router() self.assertTrue(router['ha']) -- 2.45.2