From f88b8eae7aae64bf637dea4d3be4e1684fc756d8 Mon Sep 17 00:00:00 2001 From: Assaf Muller Date: Wed, 11 Feb 2015 10:55:19 -0500 Subject: [PATCH] Cleanup in keepalived tests A recent patch introduced a new keepalived manager utility function which returns the keepalived.conf file contents, but the keepalived functional test was not updated to use it. Also, a bunch of unneeded logging configuration was removed from this test. Additionally, the keepalived configuration functional test in the L3 agent testing module compares expected configuration to an in-memory representation of the configuration that will be persisted to disk. It's better to compare the expected configuation with what was actually written to disk. Change-Id: I0d6f73c5326d2ba1960456a151a67517db5cce7a --- .../functional/agent/linux/test_keepalived.py | 15 ++------------- neutron/tests/functional/agent/test_l3_agent.py | 2 +- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/neutron/tests/functional/agent/linux/test_keepalived.py b/neutron/tests/functional/agent/linux/test_keepalived.py index f4a62779a..70565c8f1 100644 --- a/neutron/tests/functional/agent/linux/test_keepalived.py +++ b/neutron/tests/functional/agent/linux/test_keepalived.py @@ -15,26 +15,17 @@ from oslo_config import cfg -from neutron.agent.common import config from neutron.agent.linux import external_process from neutron.agent.linux import keepalived -from neutron.openstack.common import log as logging from neutron.tests.functional import base as functional_base from neutron.tests.unit.agent.linux import test_keepalived -LOG = logging.getLogger(__name__) - class KeepalivedManagerTestCase(functional_base.BaseSudoTestCase, test_keepalived.KeepalivedConfBaseMixin): def setUp(self): super(KeepalivedManagerTestCase, self).setUp() self.check_sudo_enabled() - self._configure() - - def _configure(self): - cfg.CONF.set_override('debug', False) - config.setup_logging() def test_keepalived_spawn(self): expected_config = self._get_config() @@ -52,7 +43,5 @@ class KeepalivedManagerTestCase(functional_base.BaseSudoTestCase, pids_path=cfg.CONF.state_path) self.assertTrue(process.active) - config_path = manager._get_full_config_file_path('keepalived.conf') - with open(config_path, 'r') as config_file: - config_contents = config_file.read() - self.assertEqual(expected_config.get_config_str(), config_contents) + self.assertEqual(expected_config.get_config_str(), + manager.get_conf_on_disk()) diff --git a/neutron/tests/functional/agent/test_l3_agent.py b/neutron/tests/functional/agent/test_l3_agent.py index 5b45cd887..c83e0507d 100755 --- a/neutron/tests/functional/agent/test_l3_agent.py +++ b/neutron/tests/functional/agent/test_l3_agent.py @@ -298,7 +298,7 @@ class L3AgentTestCase(L3AgentTestFramework): expected = self.get_expected_keepalive_configuration(router) self.assertEqual(expected, - router.keepalived_manager.config.get_config_str()) + router.keepalived_manager.get_conf_on_disk()) # Add a new FIP and change the GW IP address router.router = copy.deepcopy(router.router) -- 2.45.2