Mercurial > illumos > illumos-gate
annotate usr/src/test/zfs-tests/tests/functional/cli_root/zfs_promote/zfs_promote_004_pos.ksh @ 13899:0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
3312 Add a testrunner package for OS unit tests
3313 Add a testrunner package to convert ZFS tests from STF
Reviewed by: Matt Ahrens <matthew.ahrens@delphix.com>
Reviewed by: Will Guyette <will.guyette@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Henrik Mattson <henrik.mattson@delphix.com>
Reviewed by: Sonu Pillai <sonu.pillai@delphix.com>
Reviewed by: Christopher Siden <chris.siden@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Approved by: Richard Lowe <richlowe@richlowe.net>
author | John Wren Kennedy <john.kennedy@delphix.com> |
---|---|
date | Wed, 05 Dec 2012 22:04:50 -0500 |
parents | |
children |
rev | line source |
---|---|
13899
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
1 #!/bin/ksh -p |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
2 # |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
3 # CDDL HEADER START |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
4 # |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
5 # The contents of this file are subject to the terms of the |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
6 # Common Development and Distribution License (the "License"). |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
7 # You may not use this file except in compliance with the License. |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
8 # |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
10 # or http://www.opensolaris.org/os/licensing. |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
11 # See the License for the specific language governing permissions |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
12 # and limitations under the License. |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
13 # |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
14 # When distributing Covered Code, include this CDDL HEADER in each |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
16 # If applicable, add the following below this CDDL HEADER, with the |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
17 # fields enclosed by brackets "[]" replaced with your own identifying |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
18 # information: Portions Copyright [yyyy] [name of copyright owner] |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
19 # |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
20 # CDDL HEADER END |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
21 # |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
22 |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
23 # |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
24 # Copyright 2007 Sun Microsystems, Inc. All rights reserved. |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
25 # Use is subject to license terms. |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
26 # |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
27 |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
28 # |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
29 # Copyright (c) 2012 by Delphix. All rights reserved. |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
30 # |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
31 |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
32 . $STF_SUITE/tests/functional/cli_root/zfs_promote/zfs_promote.cfg |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
33 . $STF_SUITE/include/libtest.shlib |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
34 |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
35 # |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
36 # DESCRIPTION: |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
37 # 'zfs promote' can deal with multi-level clones. |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
38 # |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
39 # STRATEGY: |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
40 # 1. Create multiple snapshots and multi-level clones |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
41 # 2. Promote a clone filesystem |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
42 # 3. Verify the dataset dependency relationships are correct after promotion. |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
43 # |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
44 |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
45 verify_runnable "both" |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
46 |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
47 function cleanup |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
48 { |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
49 if snapexists ${c1snap[1]}; then |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
50 log_must $ZFS promote $clone |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
51 fi |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
52 |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
53 typeset ds |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
54 typeset data |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
55 for ds in ${snap[*]}; do |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
56 snapexists $ds && \ |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
57 log_must $ZFS destroy -rR $ds |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
58 done |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
59 for data in ${file[*]}; do |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
60 [[ -e $data ]] && $RM -f $data |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
61 done |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
62 } |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
63 |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
64 log_assert "'zfs promote' can deal with multi-level clone." |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
65 log_onexit cleanup |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
66 |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
67 fs=$TESTPOOL/$TESTFS |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
68 clone=$TESTPOOL/$TESTCLONE |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
69 clone1=$TESTPOOL/$TESTCLONE1 |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
70 |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
71 # Define some arrays here to use loop to reduce code amount |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
72 |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
73 # Array which stores the origin snapshots created in the origin filesystem |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
74 set -A snap "${fs}@$TESTSNAP" "${fs}@$TESTSNAP1" "${fs}@$TESTSNAP2" "${fs}@$TESTSNAP3" |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
75 # Array which stores the snapshots existing in the first clone |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
76 set -A csnap "${clone}@$TESTSNAP3" "${clone}@$TESTSNAP4" "${clone}@$TESTSNAP5" |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
77 # Array which stores the snapshots existing in the second clone after promote operation |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
78 set -A c1snap "${clone1}@$TESTSNAP3" "${clone1}@$TESTSNAP4" "${clone1}@$TESTSNAP5" |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
79 # The data will inject into the origin filesystem |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
80 set -A file "$TESTDIR/$TESTFILE0" "$TESTDIR/$TESTFILE1" "$TESTDIR/$TESTFILE2" \ |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
81 "$TESTDIR/$TESTFILE3" |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
82 cdir=/$TESTPOOL/$TESTCLONE |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
83 # The data will inject into the first clone |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
84 set -A cfile "${cdir}/$CLONEFILE" "${cdir}/$CLONEFILE1" "${cdir}/$CLONEFILE2" |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
85 c1snapdir=/$TESTPOOL/$TESTCLONE1/.zfs/snapshot |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
86 # The data which will exist in the snapshot of the second clone filesystem after promote |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
87 set -A c1snapfile "${c1snapdir}/$TESTSNAP3/$CLONEFILE" \ |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
88 "${c1snapdir}/$TESTSNAP4/$CLONEFILE1" \ |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
89 "${c1snapdir}/$TESTSNAP5/$CLONEFILE2" |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
90 |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
91 # setup for promote testing |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
92 typeset -i i=0 |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
93 while (( i < 4 )); do |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
94 log_must $MKFILE $FILESIZE ${file[i]} |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
95 (( i>0 )) && log_must $RM -f ${file[((i-1))]} |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
96 log_must $ZFS snapshot ${snap[i]} |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
97 |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
98 (( i = i + 1 )) |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
99 done |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
100 log_must $ZFS clone ${snap[2]} $clone |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
101 |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
102 log_must $RM -f /$clone/$TESTFILE2 |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
103 i=0 |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
104 while (( i < 3 )); do |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
105 log_must $MKFILE $FILESIZE ${cfile[i]} |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
106 (( i>0 )) && log_must $RM -f ${cfile[(( i-1 ))]} |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
107 log_must $ZFS snapshot ${csnap[i]} |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
108 |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
109 (( i = i + 1 )) |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
110 done |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
111 |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
112 log_must $ZFS clone ${csnap[1]} $clone1 |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
113 log_must $MKFILE $FILESIZE /$clone1/$CLONEFILE2 |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
114 log_must $RM -f /$clone1/$CLONEFILE1 |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
115 log_must $ZFS snapshot ${c1snap[2]} |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
116 |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
117 log_must $ZFS promote $clone1 |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
118 |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
119 # verify the 'promote' operation |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
120 for ds in ${snap[*]} ${csnap[2]} ${c1snap[*]}; do |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
121 ! snapexists $ds && \ |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
122 log_fail "The snapshot $ds disappear after zfs promote." |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
123 done |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
124 for data in ${c1snapfile[*]}; do |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
125 [[ ! -e $data ]] && \ |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
126 log_fail "The data file $data loses after zfs promote." |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
127 done |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
128 |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
129 origin_prop=$(get_prop origin $fs) |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
130 [[ "$origin_prop" != "-" ]] && \ |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
131 log_fail "The dependency is not correct for $fs after zfs promote." |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
132 origin_prop=$(get_prop origin $clone) |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
133 [[ "$origin_prop" != "${c1snap[1]}" ]] && \ |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
134 log_fail "The dependency is not correct for $clone after zfs promote." |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
135 origin_prop=$(get_prop origin $clone1) |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
136 [[ "$origin_prop" != "${snap[2]}" ]] && \ |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
137 log_fail "The dependency is not correct for $clone1 after zfs promote." |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
138 |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
139 log_pass "'zfs promote' deal with multi-level clones as expected." |
0bcf78798346
3311 Want a test framework for arbitrary OS unit tests
John Wren Kennedy <john.kennedy@delphix.com>
parents:
diff
changeset
|
140 |