]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/nfs: add test for access type validation func
authorJohn Mulligan <jmulligan@redhat.com>
Thu, 21 Apr 2022 19:34:25 +0000 (15:34 -0400)
committerAdam King <adking@redhat.com>
Sat, 21 May 2022 23:02:25 +0000 (19:02 -0400)
Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit bb2b45d7036cd6fe03c45f349c86302d7fbfbbf1)

src/pybind/mgr/nfs/tests/test_nfs.py

index 0a606dbdaaa3dab31cbe78bf95048bb83d162337..1fca67249e0d459710f521de349bd04db2be06bd 100644 (file)
@@ -1044,3 +1044,14 @@ def test_ganesha_validate_squash():
     _validate_squash("root")
     with pytest.raises(NFSInvalidOperation):
         _validate_squash("toot")
+
+
+def test_ganesha_validate_access_type():
+    """Check error handling of internal validation function for access type value."""
+    from nfs.ganesha_conf import _validate_access_type
+    from nfs.exception import NFSInvalidOperation
+
+    for ok in ("rw", "ro", "none"):
+        _validate_access_type(ok)
+    with pytest.raises(NFSInvalidOperation):
+        _validate_access_type("any")