mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-01-27 02:14:28 +03:00
Add basic functional tests for zcp user properties
Signed-off-by: Don Brady <don.brady@delphix.com>
This commit is contained in:
parent
234c91c508
commit
ee00bfb2e6
@ -78,10 +78,10 @@ tests = ['tst.destroy_fs', 'tst.destroy_snap', 'tst.get_count_and_limit',
|
||||
'tst.get_number_props', 'tst.get_string_props', 'tst.get_type',
|
||||
'tst.get_userquota', 'tst.get_written', 'tst.list_children',
|
||||
'tst.list_clones', 'tst.list_snapshots', 'tst.list_system_props',
|
||||
'tst.parse_args_neg', 'tst.promote_conflict', 'tst.promote_multiple',
|
||||
'tst.promote_simple', 'tst.rollback_mult', 'tst.rollback_one',
|
||||
'tst.snapshot_destroy', 'tst.snapshot_neg', 'tst.snapshot_recursive',
|
||||
'tst.snapshot_simple']
|
||||
'tst.list_user_props', 'tst.parse_args_neg','tst.promote_conflict',
|
||||
'tst.promote_multiple', 'tst.promote_simple', 'tst.rollback_mult',
|
||||
'tst.rollback_one', 'tst.snapshot_destroy', 'tst.snapshot_neg',
|
||||
'tst.snapshot_recursive', 'tst.snapshot_simple']
|
||||
tags = ['functional', 'channel_program', 'synctask_core']
|
||||
|
||||
[tests/functional/chattr]
|
||||
|
@ -23,6 +23,7 @@ dist_pkgdata_SCRIPTS = \
|
||||
tst.list_clones.ksh \
|
||||
tst.list_snapshots.ksh \
|
||||
tst.list_system_props.ksh \
|
||||
tst.list_user_props.ksh \
|
||||
tst.parse_args_neg.ksh \
|
||||
tst.promote_conflict.ksh \
|
||||
tst.promote_conflict.zcp \
|
||||
|
@ -0,0 +1,98 @@
|
||||
#!/bin/ksh -p
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# http://www.illumos.org/license/CDDL.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2017 by Delphix. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/tests/functional/channel_program/channel_common.kshlib
|
||||
|
||||
#
|
||||
# DESCRIPTION:
|
||||
# Listing zfs user properties should work correctly.
|
||||
#
|
||||
|
||||
verify_runnable "global"
|
||||
|
||||
TESTPROP="org.openzfs:test_property"
|
||||
TESTPROP1=$TESTPROP-1
|
||||
TESTPROP2=$TESTPROP-2
|
||||
TESTPROP3=$TESTPROP-3
|
||||
TESTPROP4=$TESTPROP-4
|
||||
|
||||
TESTVAL="true"
|
||||
TESTVAL1="busy"
|
||||
TESTVAL2="9223372036854775808"
|
||||
TESTVAL3="801f2266-3715-41f4-9080-3d5e913b0f15"
|
||||
TESTVAL4="TOZwOfACvQtmDyiq68elB3a3g9YYyxBjSnLtN3ZyQYNOAKykzIE2khKKOBncJiDx"
|
||||
|
||||
|
||||
# 0 properties handled correctly
|
||||
log_must_program $TESTPOOL - <<-EOF
|
||||
n = 0
|
||||
for p in zfs.list.properties("$TESTPOOL/$TESTFS") do
|
||||
n = n + 1
|
||||
end
|
||||
assert(n == 0)
|
||||
return 0
|
||||
EOF
|
||||
|
||||
# Add a single user property
|
||||
log_must zfs set $TESTPROP="$TESTVAL" $TESTPOOL/$TESTFS
|
||||
|
||||
log_must_program $TESTPOOL - <<-EOF
|
||||
n = 0
|
||||
for p,v in zfs.list.properties("$TESTPOOL/$TESTFS") do
|
||||
assert(p == "$TESTPROP")
|
||||
assert(v == "$TESTVAL")
|
||||
n = n + 1
|
||||
end
|
||||
assert(n == 1)
|
||||
return 0
|
||||
EOF
|
||||
|
||||
log_must zfs set $TESTPROP1="$TESTVAL1" $TESTPOOL/$TESTFS
|
||||
log_must zfs set $TESTPROP2="$TESTVAL2" $TESTPOOL/$TESTFS
|
||||
log_must zfs set $TESTPROP3="$TESTVAL3" $TESTPOOL/$TESTFS
|
||||
log_must zfs set $TESTPROP4="$TESTVAL4" $TESTPOOL/$TESTFS
|
||||
|
||||
# All user properties have correct value and appear exactly once
|
||||
log_must_program $TESTPOOL - <<-EOF
|
||||
a = {}
|
||||
a["$TESTPROP"] = false
|
||||
a["$TESTPROP1"] = false
|
||||
a["$TESTPROP2"] = false
|
||||
a["$TESTPROP3"] = false
|
||||
a["$TESTPROP4"] = false
|
||||
m = {}
|
||||
m["$TESTPROP"] = "$TESTVAL"
|
||||
m["$TESTPROP1"] = "$TESTVAL1"
|
||||
m["$TESTPROP2"] = "$TESTVAL2"
|
||||
m["$TESTPROP3"] = "$TESTVAL3"
|
||||
m["$TESTPROP4"] = "$TESTVAL4"
|
||||
n = 0
|
||||
for p,v in zfs.list.properties("$TESTPOOL/$TESTFS") do
|
||||
assert(not a[p])
|
||||
a[p] = true
|
||||
assert(v == m[p])
|
||||
n = n + 1
|
||||
end
|
||||
assert(n == 5)
|
||||
assert(a["$TESTPROP"] and
|
||||
a["$TESTPROP1"] and
|
||||
a["$TESTPROP2"] and
|
||||
a["$TESTPROP3"] and
|
||||
a["$TESTPROP4"])
|
||||
return 0
|
||||
EOF
|
||||
|
||||
log_pass "Listing zfs user properies should work correctly."
|
Loading…
Reference in New Issue
Block a user