Fix unit test failure
This patch fixes the unit test for os_profiler. The assertion is made based on whether os_profiler is installed (importable). Change-Id: I52e47b07c019e73fc57b5c6461a4b33d87e4392a Closes-Bug: 1706885
This commit is contained in:
parent
65dcd7e75d
commit
821b27f19b
@ -99,7 +99,7 @@ class SenlinShell(object):
|
||||
print(' '.join(commands | options))
|
||||
|
||||
def add_profiler_args(self, parser):
|
||||
if isinstance(osprofiler_profiler, int):
|
||||
if osprofiler_profiler:
|
||||
parser.add_argument(
|
||||
'--os-profile',
|
||||
metavar='HMAC_KEY',
|
||||
|
@ -191,8 +191,10 @@ class ShellTest(testtools.TestCase):
|
||||
parser = mock.Mock()
|
||||
|
||||
sh.add_profiler_args(parser)
|
||||
|
||||
self.assertEqual(0, parser.add_argument.call_count)
|
||||
if shell.osprofiler_profiler:
|
||||
self.assertEqual(1, parser.add_argument.call_count)
|
||||
else:
|
||||
self.assertEqual(0, parser.add_argument.call_count)
|
||||
|
||||
@mock.patch.object(utils, 'import_versioned_module')
|
||||
@mock.patch.object(shell.SenlinShell, '_find_actions')
|
||||
|
Loading…
x
Reference in New Issue
Block a user