From 1a59023772d23c3c870621f02657536a4da57e42 Mon Sep 17 00:00:00 2001 From: Jiri Podivin Date: Thu, 28 Apr 2022 10:51:16 +0200 Subject: [PATCH] Mocking utils.check_deploy_backups in OvercloudDeploy tests The `check_deploy_backups` makes calls to `stat` which can potentially lead to I/O error in testing scenarios when the relevant file is removed after path retrieval but before `stat` is called. This can lead to tox test failure, in both CI and local environments. Mocking the utils.check_deploy_backups in tests where it is indirectly called should alleviate the problem. Long term solution would be mocking all built in functions performing I/O calls by default. Closes-Bug: #1969425 Signed-off-by: Jiri Podivin Change-Id: I96d4bfce84ffe36d476e3383ee264cea6fd93c24 --- .../tests/v1/overcloud_deploy/test_overcloud_deploy.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py b/tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py index 43753b50f..19deacd38 100644 --- a/tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py +++ b/tripleoclient/tests/v1/overcloud_deploy/test_overcloud_deploy.py @@ -126,6 +126,11 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud): mock_copy_to_wd.start() self.addCleanup(mock_copy_to_wd.stop) + mock_check_deploy_backups = mock.patch( + 'tripleoclient.utils.check_deploy_backups', autospec=True) + mock_check_deploy_backups.start() + self.addCleanup(mock_check_deploy_backups.stop) + def tearDown(self): super(TestDeployOvercloud, self).tearDown() os.unlink(self.parameter_defaults_env_file)