diff options
-rw-r--r-- | docker/core/Dockerfile | 3 | ||||
-rw-r--r-- | functest/opnfv_tests/openstack/tempest/conf_utils.py | 2 | ||||
-rw-r--r-- | functest/tests/unit/openstack/tempest/test_conf_utils.py | 16 |
3 files changed, 17 insertions, 4 deletions
diff --git a/docker/core/Dockerfile b/docker/core/Dockerfile index 0ab809aad..172dbb9fa 100644 --- a/docker/core/Dockerfile +++ b/docker/core/Dockerfile @@ -13,9 +13,6 @@ RUN apk --no-cache add --update \ wget -q -O- https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=$OPENSTACK_TAG | \ sed -E s/^tempest==+\(.*\)$/-e\ git+https:\\/\\/github.com\\/openstack\\/tempest@\\1#egg=tempest/ \ > upper-constraints.txt && \ - pip install -U --no-cache-dir -cupper-constraints.txt \ - -chttps://git.opnfv.org/functest/plain/upper-constraints.txt?h=$BRANCH \ - git+https://github.com/pypa/pip.git && \ pip install --no-cache-dir --src /src -cupper-constraints.txt \ -chttps://git.opnfv.org/functest/plain/upper-constraints.txt?h=$BRANCH \ -e git+https://github.com/openstack/requirements@stable/ocata#egg=openstack_requirements && \ diff --git a/functest/opnfv_tests/openstack/tempest/conf_utils.py b/functest/opnfv_tests/openstack/tempest/conf_utils.py index 88d96ebd6..72ea5ce72 100644 --- a/functest/opnfv_tests/openstack/tempest/conf_utils.py +++ b/functest/opnfv_tests/openstack/tempest/conf_utils.py @@ -130,6 +130,8 @@ def backup_tempest_config(conf_file): """ Copy config file to tempest results directory """ + if not os.path.exists(TEMPEST_RESULTS_DIR): + os.makedirs(TEMPEST_RESULTS_DIR) shutil.copyfile(conf_file, os.path.join(TEMPEST_RESULTS_DIR, 'tempest.conf')) diff --git a/functest/tests/unit/openstack/tempest/test_conf_utils.py b/functest/tests/unit/openstack/tempest/test_conf_utils.py index 77558086b..22017a7a2 100644 --- a/functest/tests/unit/openstack/tempest/test_conf_utils.py +++ b/functest/tests/unit/openstack/tempest/test_conf_utils.py @@ -170,9 +170,23 @@ class OSTempestConfUtilsTesting(unittest.TestCase): def test_backup_tempest_config_default(self): with mock.patch('functest.opnfv_tests.openstack.tempest.' - 'conf_utils.shutil.copyfile') as m1: + 'conf_utils.os.path.exists', + return_value=False), \ + mock.patch('functest.opnfv_tests.openstack.tempest.' + 'conf_utils.os.makedirs') as m1, \ + mock.patch('functest.opnfv_tests.openstack.tempest.' + 'conf_utils.shutil.copyfile') as m2: conf_utils.backup_tempest_config('test_conf_file') self.assertTrue(m1.called) + self.assertTrue(m2.called) + + with mock.patch('functest.opnfv_tests.openstack.tempest.' + 'conf_utils.os.path.exists', + return_value=True), \ + mock.patch('functest.opnfv_tests.openstack.tempest.' + 'conf_utils.shutil.copyfile') as m2: + conf_utils.backup_tempest_config('test_conf_file') + self.assertTrue(m2.called) def test_configure_tempest_default(self): with mock.patch('functest.opnfv_tests.openstack.tempest.' |