From: Sage Weil Date: Fri, 9 Jul 2021 13:54:59 +0000 (-0400) Subject: mgr/nfs: add test for ganesha conf apply/import X-Git-Tag: v17.1.0~1390^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7760cb2aedf52e247d9908b65d30250e2a049df3;p=ceph.git mgr/nfs: add test for ganesha conf apply/import Signed-off-by: Sage Weil --- diff --git a/src/pybind/mgr/nfs/tests/test_nfs.py b/src/pybind/mgr/nfs/tests/test_nfs.py index c21139e4fbab..0d8377d69219 100644 --- a/src/pybind/mgr/nfs/tests/test_nfs.py +++ b/src/pybind/mgr/nfs/tests/test_nfs.py @@ -73,6 +73,25 @@ EXPORT Secret_Access_Key = "the_secret_key"; } } +""" + export_3 = """ +EXPORT { + FSAL { + name = "CEPH"; + user_id = "nfs.foo.1"; + filesystem = "a"; + secret_access_key = "AQCjU+hgjyReLBAAddJa0Dza/ZHqjX5+JiePMA=="; + } + export_id = 1; + path = "/"; + pseudo = "/a"; + access_type = "RW"; + squash = "none"; + attr_expiration_time = 0; + security_label = true; + protocols = 4; + transports = "TCP"; +} """ conf_nodea = ''' @@ -737,6 +756,18 @@ NFS_CORE_PARAM { assert export.clients[0].access_type is None assert export.cluster_id == cluster_id + def test_update_export_with_ganesha_conf(self): + with self._mock_orchestrator(True): + for cluster_id, info in self.clusters.items(): + self._do_test_update_export_with_ganesha_conf(cluster_id, info['exports']) + self._reset_temp_store() + + def _do_test_update_export_with_ganesha_conf(self, cluster_id, expected_exports): + nfs_mod = Module('nfs', '', '') + conf = ExportMgr(nfs_mod) + r = conf.apply_export(cluster_id, self.export_3) + assert r[0] == 0 + def test_remove_export(self) -> None: with self._mock_orchestrator(True), mock.patch('nfs.module.ExportMgr._exec'): for cluster_id, info in self.clusters.items():