From: Sage Weil Date: Fri, 7 May 2021 19:01:10 +0000 (-0400) Subject: qa/tasks/cephfs/test_nfs: fix info test X-Git-Tag: v17.1.0~1854^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=218eec938d1c241a595384984aa9e002ffc68e0e;p=ceph.git qa/tasks/cephfs/test_nfs: fix info test Signed-off-by: Sage Weil --- diff --git a/qa/tasks/cephfs/test_nfs.py b/qa/tasks/cephfs/test_nfs.py index fc0c3f467a16..83c4797b2818 100644 --- a/qa/tasks/cephfs/test_nfs.py +++ b/qa/tasks/cephfs/test_nfs.py @@ -243,9 +243,9 @@ class TestNFS(MgrTestCase): ''' Return port and ip for a cluster ''' - #{'test': [{'hostname': 'smithi068', 'ip': ['172.21.15.68'], 'port': 2049}]} - info_output = json.loads(self._nfs_cmd('cluster', 'info', self.cluster_id))['test'][0] - return info_output["port"], info_output["ip"][0] + #{'test': {'backend': [{'hostname': 'smithi068', 'ip': '172.21.15.68', 'port': 2049}]}} + info_output = json.loads(self._nfs_cmd('cluster', 'info', self.cluster_id))['test']['backend'][0] + return info_output["port"], info_output["ip"] def _test_mnt(self, pseudo_path, port, ip, check=True): ''' @@ -443,14 +443,23 @@ class TestNFS(MgrTestCase): ''' self._test_create_cluster() info_output = json.loads(self._nfs_cmd('cluster', 'info', self.cluster_id)) - info_ip = info_output[self.cluster_id][0].pop("ip") - host_details = {self.cluster_id: [{ - "hostname": self._sys_cmd(['hostname']).decode("utf-8").strip(), - "port": 2049 - }]} + print(f'info {info_output}') + info_ip = info_output[self.cluster_id].get('backend', [])[0].pop("ip") + host_details = { + self.cluster_id: { + 'backend': [ + { + "hostname": self._sys_cmd(['hostname']).decode("utf-8").strip(), + "port": 2049 + } + ], + "virtual_ip": None, + } + } host_ip = self._sys_cmd(['hostname', '-I']).decode("utf-8").split() + print(f'host_ip is {host_ip}, info_ip is {info_ip}') self.assertDictEqual(info_output, host_details) - self.assertTrue(any([ip in info_ip for ip in host_ip])) + self.assertTrue(info_ip in host_ip) self._test_delete_cluster() def test_cluster_set_reset_user_config(self): diff --git a/src/pybind/mgr/cephadm/tests/test_cephadm.py b/src/pybind/mgr/cephadm/tests/test_cephadm.py index 2517e288493d..53d1f7283ada 100644 --- a/src/pybind/mgr/cephadm/tests/test_cephadm.py +++ b/src/pybind/mgr/cephadm/tests/test_cephadm.py @@ -755,6 +755,7 @@ class TestCephadm(object): @mock.patch("cephadm.serve.CephadmServe._run_cephadm", _run_cephadm('{}')) @mock.patch("cephadm.services.nfs.NFSService.run_grace_tool", mock.MagicMock()) + @mock.patch("cephadm.services.nfs.NFSService.purge", mock.MagicMock()) @mock.patch("cephadm.services.nfs.NFSService.create_rados_config_obj", mock.MagicMock()) def test_nfs(self, cephadm_module): with with_host(cephadm_module, 'test'):