]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/smb: add unit tests to verify deleting shares by wildcard
authorJohn Mulligan <jmulligan@redhat.com>
Mon, 20 Apr 2026 19:17:47 +0000 (15:17 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Wed, 6 May 2026 19:41:26 +0000 (15:41 -0400)
Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/pybind/mgr/smb/tests/test_smb.py

index c9e2eec5a63673e1c5c432fb4bb1cab274f2ff2e..10a6ee5478083e2e926e08197f6f8a696162127c 100644 (file)
@@ -1279,3 +1279,26 @@ def test_share_fscrypt_config_error(tmodule, params):
     assert len(failures) == 1
     failure = failures[0]
     assert params['expected'] in failure.msg
+
+
+def test_share_rm_wildcard(tmodule):
+    _example_cfg_1(tmodule)
+
+    result = tmodule.share_rm('foo', 's*', wildcard=True)
+    assert result.success
+    assert len(list(result)) == 2
+
+
+def test_share_rm_wildcard_one_match(tmodule):
+    _example_cfg_1(tmodule)
+
+    result = tmodule.share_rm('foo', 'st*', wildcard=True)
+    assert result.success
+    assert len(list(result)) == 1
+
+
+def test_share_rm_wildcard_no_match(tmodule):
+    _example_cfg_1(tmodule)
+
+    with pytest.raises(smb.cli.NoMatchingValue):
+        tmodule.share_rm('foo', 'q*', wildcard=True)