From: John Mulligan Date: Thu, 18 May 2023 20:46:50 +0000 (-0400) Subject: cephadm: fix a cephadm test when docker doesn't exist X-Git-Tag: v19.0.0~1122^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=66b23909687e91d737ec7f54928940ae263b81df;p=ceph-ci.git cephadm: fix a cephadm test when docker doesn't exist Previously, when I ran the cephadm test suite locally the test case test_mon_crush_location was failing with the error: ``` > with pytest.raises(Exception, match='--set-crush-location database=a'): E AssertionError: Regex pattern did not match. E Regex: '--set-crush-location database=a' E Input: "[Errno 2] No such file or directory: '/usr/bin/docker'" ``` At the very least this test should run on a system that doesn't have docker installed. Although, I don't know why this test would have passed on any system that wasn't actively running a cephadm container... This patch mocks out `extract_uid_gid` which was calling out to docker even in the unit tests. Signed-off-by: John Mulligan --- diff --git a/src/cephadm/tests/test_cephadm.py b/src/cephadm/tests/test_cephadm.py index 3dd64a605a8..e9976c0860c 100644 --- a/src/cephadm/tests/test_cephadm.py +++ b/src/cephadm/tests/test_cephadm.py @@ -299,6 +299,7 @@ class TestCephAdm(object): @mock.patch('cephadm.migrate_sysctl_dir') @mock.patch('cephadm.check_unit', lambda *args, **kwargs: (None, 'running', None)) @mock.patch('cephadm.get_unit_name', lambda *args, **kwargs: 'mon-unit-name') + @mock.patch('cephadm.extract_uid_gid', lambda *args, **kwargs: (0, 0)) @mock.patch('cephadm.get_deployment_container') def test_mon_crush_location(self, _get_deployment_container, _migrate_sysctl, _make_var_run, _get_parm, _deploy_daemon, _file_lock, _logger): """