summaryrefslogtreecommitdiffstats
path: root/apex/tests/test_apex_common_builder.py
diff options
context:
space:
mode:
authorTim Rozet <trozet@redhat.com>2018-10-26 14:03:17 -0400
committerTim Rozet <trozet@redhat.com>2018-11-01 08:46:58 -0400
commitd38e8a91c1a0e3f94d2a19876956ade48d1a8ed2 (patch)
tree9fa6ea0446ad7341e67d1b5ed2c0cf352db219e5 /apex/tests/test_apex_common_builder.py
parentf20730a6633a9f910a804d5205fbdbff17e622d0 (diff)
Fixes Docker image upload for master/rocky
The API has changed to create/upload the docker container images to be used for deployment. In the past the prepare commands would read the THT environment files passed, to determine which docker images to render into an environment file. The new behavior uses a new "containers-prepare-parameter.yaml" format (included in this patch), which Apex will now configure for deployment. By default docker images will be rendered for all TripleO services identified in the roles_data.yaml file. Therefore we must use several excludes patterns to only pull the docker images needed for a default deployment. JIRA: APEX-642 Change-Id: Iab00fcb874554bb98540dc9a4c3051e58ea68a3b Signed-off-by: Tim Rozet <trozet@redhat.com>
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)