Fix lint and unit tests
This commit is contained in:
parent
a0bc348fbb
commit
0a5e106ed4
@ -170,6 +170,7 @@ LEGACY_FILES_MAP = {
|
||||
LEGACY_RES_MAP = ['res_monitor']
|
||||
L3HA_PACKAGES = ['keepalived']
|
||||
|
||||
|
||||
def get_early_packages():
|
||||
'''Return a list of package for pre-install based on configured plugin'''
|
||||
if config('plugin') in [OVS]:
|
||||
@ -182,6 +183,7 @@ def get_early_packages():
|
||||
return pkgs + [headers_package()]
|
||||
return pkgs
|
||||
|
||||
|
||||
def get_packages():
|
||||
'''Return a list of packages for install based on the configured plugin'''
|
||||
plugin = remap_plugin(config('plugin'))
|
||||
@ -200,17 +202,20 @@ def get_packages():
|
||||
packages.extend(determine_l3ha_packages())
|
||||
return packages
|
||||
|
||||
|
||||
def determine_l3ha_packages():
|
||||
if use_l3ha():
|
||||
return L3HA_PACKAGES
|
||||
return []
|
||||
|
||||
|
||||
def get_common_package():
|
||||
if get_os_codename_package('quantum-common', fatal=False) is not None:
|
||||
return 'quantum-common'
|
||||
else:
|
||||
return 'neutron-common'
|
||||
|
||||
|
||||
def use_l3ha():
|
||||
return neutron_api_settings()['enable_l3ha']
|
||||
|
||||
|
@ -47,7 +47,8 @@ TO_PATCH = [
|
||||
'get_hacluster_config',
|
||||
'remove_legacy_ha_files',
|
||||
'cleanup_ovs_netns',
|
||||
'stop_neutron_ha_monitor_daemon'
|
||||
'stop_neutron_ha_monitor_daemon',
|
||||
'use_l3ha',
|
||||
]
|
||||
|
||||
|
||||
@ -247,9 +248,9 @@ class TestQuantumHooks(CharmTestCase):
|
||||
self.install_ca_cert.assert_called_with('cert')
|
||||
|
||||
def test_neutron_plugin_changed(self):
|
||||
self.filter_installed_packages.return_value = ['foo']
|
||||
self.use_l3ha.return_value = True
|
||||
self._call_hook('neutron-plugin-api-relation-changed')
|
||||
self.apt_install.assert_called_with(['foo'], fatal=True)
|
||||
self.apt_install.assert_called_with(['keepalived'], fatal=True)
|
||||
self.assertTrue(self.CONFIGS.write_all.called)
|
||||
|
||||
def test_cluster_departed_nvp(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user