From: Sebastian Wagner Date: Wed, 2 Jun 2021 10:42:54 +0000 (+0200) Subject: mgr/nfs: Add __eq__ method to Export X-Git-Tag: v17.1.0~1551^2~42 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b3ddff838461be1805612184a6cd8ccbedb03ae5;p=ceph.git mgr/nfs: Add __eq__ method to Export Signed-off-by: Sebastian Wagner --- diff --git a/src/pybind/mgr/nfs/export_utils.py b/src/pybind/mgr/nfs/export_utils.py index 4efe1dc8fac1..b5aceb24fe26 100644 --- a/src/pybind/mgr/nfs/export_utils.py +++ b/src/pybind/mgr/nfs/export_utils.py @@ -494,3 +494,8 @@ class Export: pass else: raise NFSInvalidOperation('FSAL {self.fsal.name} not supported') + + def __eq__(self, other): + if not isinstance(other, Export): + return False + return self.to_dict() == other.to_dict() diff --git a/src/pybind/mgr/nfs/tests/test_nfs.py b/src/pybind/mgr/nfs/tests/test_nfs.py index 13386c4a2283..f7a4ced10340 100644 --- a/src/pybind/mgr/nfs/tests/test_nfs.py +++ b/src/pybind/mgr/nfs/tests/test_nfs.py @@ -198,9 +198,8 @@ EXPORT pool=cluster_info['pool'], namespace=cluster_info['namespace'])) ] if enable else [] - # pylint: disable=protected-access - #ganesha.Ganesha._get_orch_nfs_services = Mock(return_value=orch_nfs_services) + """ # mock nfs daemons def _get_nfs_instances(service_name=None): if not enable: @@ -220,6 +219,8 @@ EXPORT for _, daemons in instances.items(): result.extend(daemons) return result + """ + with mock.patch('nfs.module.Module.describe_service') as describe_service, \ mock.patch('nfs.module.Module.rados') as rados: @@ -233,9 +234,6 @@ EXPORT yield - #ganesha.ExportMgrOrchestrator._get_orch_nfs_instances = Mock( - # side_effect=_get_nfs_instances) - def test_parse_daemon_raw_config(self): expected_daemon_config = [ { diff --git a/src/pybind/mgr/tests/__init__.py b/src/pybind/mgr/tests/__init__.py index bf96525193d2..7f15828cd6c7 100644 --- a/src/pybind/mgr/tests/__init__.py +++ b/src/pybind/mgr/tests/__init__.py @@ -175,11 +175,11 @@ if 'UNITTEST' in os.environ: self._store = {} - if self.__class__.__name__ not in M_classes: + if self.__class__ not in M_classes: # call those only once. self._register_commands('') self._register_options('') - M_classes.add(self.__class__.__name__) + M_classes.add(self.__class__) super(M, self).__init__() self._ceph_get_version = mock.Mock() diff --git a/src/pybind/mgr/tox.ini b/src/pybind/mgr/tox.ini index 3181b6e97cb4..c54a657dd39e 100644 --- a/src/pybind/mgr/tox.ini +++ b/src/pybind/mgr/tox.ini @@ -43,6 +43,7 @@ commands = tests/ \ cephadm/ \ mds_autoscaler/ \ + nfs/ \ orchestrator/ \ insights/ \ pg_autoscaler/ \