Fixup tests for dkms package determination via charm-helpers
This commit is contained in:
1 parent
9ef32e7f74
commit
2875e5ff03
2 files changed
+8
-11
No files matched your search
@@ -24,6 +24,10 @@ from charmhelpers.contrib.openstack.utils import (
|
||||
get_hostname
|
||||
)
|
||||
|
||||
from charmhelpers.contrib.openstack.neutron import (
|
||||
determine_dkms_package
|
||||
)
|
||||
|
||||
import charmhelpers.contrib.openstack.context as context
|
||||
import charmhelpers.contrib.openstack.templating as templating
|
||||
from charmhelpers.contrib.openstack.neutron import headers_package
|
||||
@@ -101,16 +105,11 @@ GATEWAY_PKGS = {
|
||||
NEUTRON: NEUTRON_GATEWAY_PKGS,
|
||||
}
|
||||
|
||||
EARLY_PACKAGES = {
|
||||
OVS: ['openvswitch-datapath-dkms'],
|
||||
NVP: []
|
||||
}
|
||||
|
||||
|
||||
def get_early_packages():
|
||||
'''Return a list of package for pre-install based on configured plugin'''
|
||||
if config('plugin') in EARLY_PACKAGES:
|
||||
pkgs = EARLY_PACKAGES[config('plugin')]
|
||||
if config('plugin') in [OVS]:
|
||||
pkgs = determine_dkms_package()
|
||||
else:
|
||||
return []
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ TO_PATCH = [
|
||||
'unit_private_ip',
|
||||
'relations_of_type',
|
||||
'service_stop',
|
||||
'determine_dkms_package'
|
||||
]
|
||||
|
||||
|
||||
@@ -62,6 +63,7 @@ class TestQuantumUtils(CharmTestCase):
|
||||
|
||||
def test_get_early_packages_ovs(self):
|
||||
self.config.return_value = 'ovs'
|
||||
self.determine_dkms_package.return_value = ['openvswitch-datapath-dkms']
|
||||
self.assertEquals(
|
||||
quantum_utils.get_early_packages(),
|
||||
['openvswitch-datapath-dkms', 'linux-headers-2.6.18'])
|
||||
@@ -72,10 +74,6 @@ class TestQuantumUtils(CharmTestCase):
|
||||
quantum_utils.get_early_packages(),
|
||||
[])
|
||||
|
||||
@patch.object(quantum_utils, 'EARLY_PACKAGES')
|
||||
def test_get_early_packages_no_dkms(self, _early_packages):
|
||||
pass
|
||||
|
||||
def test_get_early_packages_empty(self):
|
||||
self.config.return_value = 'noop'
|
||||
self.assertEquals(quantum_utils.get_early_packages(),
|
||||
|
||||
Reference in new issue
Block a user