From ee6ebce693d156f01edafdbb502b502677040b3a Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Mon, 20 Apr 2026 15:17:47 -0400 Subject: [PATCH] mgr/smb: add unit tests to verify deleting shares by wildcard Signed-off-by: John Mulligan --- src/pybind/mgr/smb/tests/test_smb.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/pybind/mgr/smb/tests/test_smb.py b/src/pybind/mgr/smb/tests/test_smb.py index c9e2eec5a63..10a6ee54780 100644 --- a/src/pybind/mgr/smb/tests/test_smb.py +++ b/src/pybind/mgr/smb/tests/test_smb.py @@ -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) -- 2.47.3