summaryrefslogtreecommitdiffstats
path: root/apex/tests/test_apex_overcloud_builder.py
diff options
context:
space:
mode:
authorTim Rozet <trozet@redhat.com>2017-09-12 17:32:56 -0400
committerTim Rozet <trozet@redhat.com>2017-11-06 04:35:02 +0000
commitb3c610b205f88dddb02cdac39638c52eafaaf82c (patch)
tree4826027e2d968e61c8024d972f3665ff3a8a09d7 /apex/tests/test_apex_overcloud_builder.py
parent3c7556eb0734706f28588fb952eedea2d424c6d2 (diff)
Adds ability to deploy from upstream openstack
To deploy with upstream openstack branch, use new deploy setting 'os_version'. A default scenario file for nosdn with pike has been included in this patch. If 'os_version' is a version other than the default version for this OPNFV release, then upstream is used. In order to use upstream with the current OS version use '--upstream' argument to the deploy command, to force an upstream deployment. Also include '-e upstream-environment.yaml' to use default upstream deployment settings. Supports nosdn and odl-nofeature deployments. Change-Id: Ic07e308827b449637b4e86cdd086434e4de2fb69 Signed-off-by: Tim Rozet <trozet@redhat.com>
Diffstat (limited to 'apex/tests/test_apex_overcloud_builder.py')
-rw-r--r--apex/tests/test_apex_overcloud_builder.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/apex/tests/test_apex_overcloud_builder.py b/apex/tests/test_apex_overcloud_builder.py
new file mode 100644
index 00000000..e9a6e6cf
--- /dev/null
+++ b/apex/tests/test_apex_overcloud_builder.py
@@ -0,0 +1,50 @@
+##############################################################################
+# Copyright (c) 2017 Tim Rozet (Red Hat)
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+import unittest
+
+from apex.builders import overcloud_builder as oc_builder
+from apex.common import constants as con
+from mock import patch
+
+
+class TestOvercloudBuilder(unittest.TestCase):
+ @classmethod
+ def setup_class(cls):
+ """This method is run once for each class before any tests are run"""
+
+ @classmethod
+ def teardown_class(cls):
+ """This method is run once for each class _after_ all tests are run"""
+
+ def setup(self):
+ """This method is run once before _each_ test method is executed"""
+
+ def teardown(self):
+ """This method is run once after _each_ test method is executed"""
+
+ @patch('apex.builders.common_builder.create_git_archive')
+ @patch('apex.builders.common_builder.add_repo')
+ @patch('apex.virtual.utils.virt_customize')
+ def test_inject_opendaylight(self, mock_customize, mock_add_repo,
+ mock_git_archive):
+ mock_git_archive.return_value = '/dummytmp/puppet-opendaylight.tar'
+ archive = '/dummytmp/puppet-opendaylight.tar'
+ test_virt_ops = [
+ {con.VIRT_INSTALL: 'opendaylight'},
+ {con.VIRT_UPLOAD: "{}:/etc/puppet/modules/".format(archive)},
+ {con.VIRT_RUN_CMD: 'rm -rf /etc/puppet/modules/opendaylight'},
+ {con.VIRT_RUN_CMD: "cd /etc/puppet/modules/ && tar xvf "
+ "puppet-opendaylight.tar"}
+ ]
+ oc_builder.inject_opendaylight(con.DEFAULT_ODL_VERSION, 'dummy.qcow2',
+ '/dummytmp/')
+ assert mock_git_archive.called
+ assert mock_add_repo.called
+ mock_customize.assert_called_once_with(test_virt_ops, 'dummy.qcow2')