tests: zfs_unshare_006: log_unsupported iff usershares are actually off

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13259
This commit is contained in:
наб
2022-03-11 01:42:32 +01:00
committed by Brian Behlendorf
parent a3dcc0aa0c
commit 3886e7081a
2 changed files with 12 additions and 13 deletions
@@ -41,9 +41,7 @@
verify_runnable "global"
if is_linux; then
log_unsupported "some distros come with Samba "user shares" disabled"
fi
[ -d "/var/lib/samba/usershares" ] || log_unsupported "Samba usershares disabled"
function cleanup
{
@@ -51,9 +49,10 @@ function cleanup
log_must zfs destroy -f $TESTPOOL/$TESTFS/shared1
log_must zfs destroy -f $TESTPOOL/$TESTFS/shared2
log_must zfs destroy -f $TESTPOOL/$TESTFS/shared3
log_must rm -f /var/lib/samba/usershares/testpool_testfs_shared{2,3}
}
log_assert "Verify 'zfs unshare [nfs|smb] -a' only works on the specified "\
log_assert "Verify 'zfs unshare [nfs|smb] -a' only works on the specified" \
"protocol."
log_onexit cleanup
@@ -74,19 +73,19 @@ log_must zfs share -a
log_must zfs unshare nfs -a
# 3. Verify that only nfs filesystems are unshared.
log_must eval "not_shared $TESTPOOL/$TESTFS/shared1"
log_must eval "not_shared $TESTPOOL/$TESTFS/shared2"
log_must eval "is_shared_smb $TESTPOOL/$TESTFS/shared2"
log_must eval "is_shared_smb $TESTPOOL/$TESTFS/shared3"
log_must not_shared $TESTPOOL/$TESTFS/shared1
log_must not_shared $TESTPOOL/$TESTFS/shared2
log_must is_shared_smb $TESTPOOL/$TESTFS/shared2
log_must is_shared_smb $TESTPOOL/$TESTFS/shared3
# 4. Share all filesystems again.
log_must zfs share -a
# 5. Invoke 'zfs unshare smb -a' and verify only smb filesystems are unshared.
log_must zfs unshare smb -a
log_must eval "is_shared $TESTPOOL/$TESTFS/shared1"
log_must eval "is_shared $TESTPOOL/$TESTFS/shared2"
log_must eval "not_shared_smb $TESTPOOL/$TESTFS/shared2"
log_must eval "not_shared_smb $TESTPOOL/$TESTFS/shared3"
log_must is_shared $TESTPOOL/$TESTFS/shared1
log_must is_shared $TESTPOOL/$TESTFS/shared2
log_must not_shared_smb $TESTPOOL/$TESTFS/shared2
log_must not_shared_smb $TESTPOOL/$TESTFS/shared3
log_pass "'zfs unshare [nfs|smb] -a' only works on the specified protocol."