summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorInsanePrawn <[email protected]>2019-11-19 01:44:28 +0100
committerBrian Behlendorf <[email protected]>2019-11-18 16:44:28 -0800
commit8221bcf1e4efc40d92d1354de710048c70eb709b (patch)
tree767d12a6077dc4fc9ec96e67f5bc582dd5f9e3d7 /tests
parent7ae3f8dc8f1e075108f91ddf6fb16471d4a0f044 (diff)
Remove requirement for -d 1 for zfs list and zfs get with bookmarks
df58307 removed the need to specify -d 1 when zfs list and zfs get are called with -t snapshot on a datset. This commit extends the same behaviour to -t bookmark. This commit also introduces the 'snap' shorthand for snapshots from zfs list to zfs get. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Tom Caputi <[email protected]> Reviewed-by: Kjeld Schouten <[email protected]> Signed-off-by: InsanePrawn <[email protected]> Closes #9589
Diffstat (limited to 'tests')
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_009_pos.ksh11
-rw-r--r--tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_list_d.kshlib3
2 files changed, 13 insertions, 1 deletions
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_009_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_009_pos.ksh
index 2d97c5918..d4ebbb155 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_009_pos.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_009_pos.ksh
@@ -92,5 +92,16 @@ log_must eval "zfs get -H -t snapshot -o name creation $DEPTH_FS > $DEPTH_OUTPUT
log_must eval "zfs get -H -t snapshot -d 1 -o name creation $DEPTH_FS > $EXPECT_OUTPUT"
log_must diff $DEPTH_OUTPUT $EXPECT_OUTPUT
+# Ensure 'zfs get -t snap' works as a shorthand for 'zfs get -t snapshot'
+log_must eval "zfs get -H -t snap -d 1 -o name creation $DEPTH_FS > $DEPTH_OUTPUT"
+log_must eval "zfs get -H -t snapshot -d 1 -o name creation $DEPTH_FS > $EXPECT_OUTPUT"
+log_must diff $DEPTH_OUTPUT $EXPECT_OUTPUT
+
+# Ensure 'zfs get -t bookmark <dataset>' works as though -d 1 was specified
+log_must eval "zfs get -H -t bookmark -o name creation $DEPTH_FS > $DEPTH_OUTPUT"
+log_must eval "zfs get -H -t bookmark -d 1 -o name creation $DEPTH_FS > $EXPECT_OUTPUT"
+log_must diff $DEPTH_OUTPUT $EXPECT_OUTPUT
+
+
log_pass "'zfs get -d <n>' should get expected output."
diff --git a/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_list_d.kshlib b/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_list_d.kshlib
index 8ef8d9aa1..48b3268f7 100644
--- a/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_list_d.kshlib
+++ b/tests/zfs-tests/tests/functional/cli_root/zfs_get/zfs_get_list_d.kshlib
@@ -37,7 +37,7 @@ set -A depth_options "d 0" "d 1" "d 2" "d 4" "d 32"
set -A depth_array 0 1 2 4 32
#
-# Setup multiple depths datasets, including fs, volume and snapshot.
+# Setup multiple depths datasets, including fs, volumes, snapshots and bookmarks.
#
function depth_fs_setup
{
@@ -65,6 +65,7 @@ function depth_fs_setup
log_must zfs create -V 8M $fs/vol_"$j"_depth"$i"
fi
log_must zfs snapshot $fs@snap_"$j"_depth"$i"
+ log_must zfs bookmark $fs@snap_"$j"_depth"$i" '#bookmark'_"$j"_depth"$i"
(( j=j+1 ))
done
done