4 # This file and its contents are supplied under the terms of the
5 # Common Development and Distribution License ("CDDL"), version 1.0.
6 # You may only use this file in accordance with the terms of version
9 # A full copy of the text of the CDDL should have accompanied this
10 # source. A copy of the CDDL is also available via the Internet at
11 # http://www.illumos.org/license/CDDL.
15 # Copyright (c) 2017 by Delphix. All rights reserved.
18 .
$STF_SUITE/tests
/functional
/pool_checkpoint
/pool_checkpoint.kshlib
22 # Try each 'zpool checkpoint' and relevant 'zpool import' with
23 # invalid inputs to ensure it returns an error. That includes:
24 # * A non-existent pool name or no pool name at all is supplied
25 # * Pool supplied for discarding or rewinding but the pool
26 # does not have a checkpoint
27 # * A dataset or a file/directory are supplied instead of a pool
30 # 1. Create an array of parameters for the different scenarios
31 # 2. For each parameter, execute the scenarios sub-command
32 # 3. Verify that an error was returned
35 verify_runnable
"global"
38 log_onexit cleanup_test_pool
42 # Argument groups below. Note that all_args also includes
43 # an empty string as "run command with no argument".
45 set -A all_args
"" "-d" "--discard"
48 # Target groups below. Note that invalid_targets includes
49 # an empty string as "do not supply a pool name".
51 set -A invalid_targets
"" "iDontExist" "$FS0" "$FS0FILE"
52 non_checkpointed
="$TESTPOOL"
56 # Trying all checkpoint args with all invalid targets
59 while (( i
< ${#invalid_targets[*]} )); do
61 while (( j
< ${#all_args[*]} )); do
62 log_mustnot zpool checkpoint
${all_args[j]} \
71 # If the pool does not have a checkpoint, -d nor import rewind
72 # should work with it.
74 log_mustnot zpool checkpoint
-d $non_checkpointed
75 log_must zpool
export $non_checkpointed
76 log_mustnot zpool import
--rewind-to-checkpoint $non_checkpointed
77 log_must zpool import
$non_checkpointed
79 log_pass
"Badly formed checkpoint related commands with " \
80 "invalid inputs fail as expected."