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 <jpodivin@redhat.com> Change-Id: I96d4bfce84ffe36d476e3383ee264cea6fd93c24 (cherry picked from commit 1a59023772d23c3c870621f02657536a4da57e42)
This commit is contained in:
parent
559cc8cbba
commit
9d3fa0a2ef
@ -119,6 +119,11 @@ class TestDeployOvercloud(fakes.TestDeployOvercloud):
|
|||||||
mock_copy_to_wd.start()
|
mock_copy_to_wd.start()
|
||||||
self.addCleanup(mock_copy_to_wd.stop)
|
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):
|
def tearDown(self):
|
||||||
super(TestDeployOvercloud, self).tearDown()
|
super(TestDeployOvercloud, self).tearDown()
|
||||||
os.unlink(self.parameter_defaults_env_file)
|
os.unlink(self.parameter_defaults_env_file)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user