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
This commit is contained in:
Assaf Muller 2015-02-11 10:55:19 -05:00
parent a97b9a4944
commit f88b8eae7a
2 changed files with 3 additions and 14 deletions

View File

@ -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())

View File

@ -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)