test_container_engine mocks find_executable to keep command_check_host
off the real host, but command_check_host looks up 'lvcreate' (and
'systemctl') through find_program, which isn't mocked. So the test
actually needs lvcreate installed and only passes where it is.
Mock find_program too so the test doesn't depend on host binaries.
Signed-off-by: Sun Yuechi <sunyuechi@iscas.ac.cn>
class TestCheckHost:
+ @mock.patch('cephadm.find_program', return_value='foo')
@mock.patch('cephadm.find_executable', return_value='foo')
@mock.patch('cephadm.check_time_sync', return_value=True)
@mock.patch('cephadm.logger')
- def test_container_engine(self, _logger, _find_executable, _check_time_sync):
+ def test_container_engine(self, _logger, _find_executable, _check_time_sync, _find_program):
ctx = _cephadm.CephadmContext()
ctx.container_engine = None