Fixes flacky unit test wih py36

When running TestManilaCharm.test_install() with py36 sometimes
test passes and sometimes throws and error while mocking methods.
Seems to be an async race problem mocking a super method first.

This was solved by avoiding mocking super method first.

Closes-Bug: #1940552
Change-Id: Iac55321599b4866784a0631639a93fc828780647
This commit is contained in:
Gustavo Sanchez 2021-08-20 10:41:53 -04:00
parent e7ed915d2b
commit 310647c2bd
No known key found for this signature in database
GPG Key ID: CB6FDA23F1075685
1 changed files with 1 additions and 1 deletions

View File

@ -95,10 +95,10 @@ class TestManilaCharm(Helper):
return c
def test_install(self):
self.patch('builtins.super', 'super')
self.patch("subprocess.check_call", name="check_call")
self.patch("charms_openstack.charm.OpenStackCharm.assess_status",
name="assess_status")
self.patch('builtins.super', name='super')
c = manila.ManilaCharm()
c.install()
self.check_call.assert_called_once_with(["mkdir", "-p", "/etc/nova"])