]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Cleanup in keepalived tests
authorAssaf Muller <amuller@redhat.com>
Wed, 11 Feb 2015 15:55:19 +0000 (10:55 -0500)
committerAssaf Muller <amuller@redhat.com>
Thu, 12 Feb 2015 13:37:28 +0000 (08:37 -0500)
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

neutron/tests/functional/agent/linux/test_keepalived.py
neutron/tests/functional/agent/test_l3_agent.py

index f4a62779acb5c25f688dce156fbe1184cf9abc73..70565c8f1e5867ae0ad023d1911e7f35bc1b3e3d 100644 (file)
 
 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())
index 5b45cd887e58cc6c11747b4917eb3cbd995a4800..c83e0507d8ce5ffccd8ea21fe5cda588eea626ce 100755 (executable)
@@ -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)