summaryrefslogtreecommitdiffstats
path: root/apex/tests/test_apex_common_builder.py
diff options
context:
space:
mode:
Diffstat (limited to 'apex/tests/test_apex_common_builder.py')
-rw-r--r--apex/tests/test_apex_common_builder.py52
1 files changed, 52 insertions, 0 deletions
diff --git a/apex/tests/test_apex_common_builder.py b/apex/tests/test_apex_common_builder.py
index 09bd254..dede55a 100644
--- a/apex/tests/test_apex_common_builder.py
+++ b/apex/tests/test_apex_common_builder.py
@@ -24,6 +24,8 @@ DOCKER_YAML = {
}
}
+a_mock_open = mock_open(read_data=None)
+
class TestCommonBuilder(unittest.TestCase):
@classmethod
@@ -249,3 +251,53 @@ class TestCommonBuilder(unittest.TestCase):
self.assertRaises(exceptions.ApexCommonBuilderException,
c_builder.project_to_docker_image,
'nova')
+
+ def test_get_neutron_driver(self):
+ ds_opts = {'dataplane': 'fdio',
+ 'sdn_controller': 'opendaylight',
+ 'odl_version': 'master',
+ 'vpn': False,
+ 'sriov': False}
+ self.assertEquals(c_builder.get_neutron_driver(ds_opts),
+ 'opendaylight')
+ ds_opts['sdn_controller'] = None
+ ds_opts['vpp'] = True
+ self.assertEquals(c_builder.get_neutron_driver(ds_opts),
+ 'vpp')
+ ds_opts['sdn_controller'] = 'ovn'
+ self.assertEquals(c_builder.get_neutron_driver(ds_opts),
+ 'ovn')
+
+ @patch('apex.builders.common_builder.yaml')
+ @patch('apex.overcloud.deploy.os.path.isfile')
+ @patch('builtins.open', a_mock_open, create=True)
+ def test_prepare_container_images(self, mock_is_file, mock_yaml):
+ mock_yaml.safe_load.return_value = {
+ 'parameter_defaults': {
+ 'ContainerImagePrepare': [
+ {'set':
+ {'namespace': 'blah',
+ 'neutron_driver': 'null',
+ }
+ }
+ ]
+ }
+ }
+ expected_output = {
+ 'parameter_defaults': {
+ 'ContainerImagePrepare': [
+ {'set':
+ {'namespace': 'docker.io/tripleoqueens',
+ 'neutron_driver': 'opendaylight',
+ }
+ }
+ ]
+ }
+ }
+
+ c_builder.prepare_container_images('dummy.yaml', 'queens',
+ 'opendaylight')
+ mock_yaml.safe_dump.assert_called_with(
+ expected_output,
+ a_mock_open.return_value,
+ default_flow_style=False)