From 0a8bf0733705c9ab898191afda6e5f01cae9f4ca Mon Sep 17 00:00:00 2001 From: George Amanakis Date: Mon, 6 Jan 2025 10:44:16 +0100 Subject: [PATCH] expand test Signed-off-by: George Amanakis --- .../rsend/send_encrypted_hierarchy.ksh | 92 ++++++++++++++----- 1 file changed, 67 insertions(+), 25 deletions(-) diff --git a/tests/zfs-tests/tests/functional/rsend/send_encrypted_hierarchy.ksh b/tests/zfs-tests/tests/functional/rsend/send_encrypted_hierarchy.ksh index 8417afc88d33..b949e197bf36 100755 --- a/tests/zfs-tests/tests/functional/rsend/send_encrypted_hierarchy.ksh +++ b/tests/zfs-tests/tests/functional/rsend/send_encrypted_hierarchy.ksh @@ -48,49 +48,91 @@ log_onexit cleanup # Create the filesystem hierarchy log_must cleanup_pool $POOL +log_must zfs create $POOL/fs1 +log_must zfs create $POOL2/fs2 log_must eval "echo $PASSPHRASE | zfs create -o encryption=on" \ - "-o keyformat=passphrase $POOL/$FS" -log_must zfs snapshot $POOL/$FS@snap -log_must zfs clone $POOL/$FS@snap $POOL/clone -log_must zfs create $POOL/$FS/child + "-o keyformat=passphrase $POOL/fs1/$FS" +log_must zfs snapshot $POOL/fs1/$FS@snap +log_must zfs clone $POOL/fs1/$FS@snap $POOL/clone +log_must zfs create $POOL/fs1/$FS/child +#aaaaa +log_must eval "echo $PASSPHRASE | zfs create -o encryption=on" \ + "-o keyformat=passphrase $POOL/fs1/a" +log_must zfs snapshot $POOL/fs1/a@snapa +log_must zfs clone $POOL/fs1/a@snapa $POOL/clonea +log_must zfs create $POOL/fs1/a/childa # Back up the tree and verify the structure log_must zfs snapshot -r $POOL@before log_must eval "zfs send -wR $POOL@before > $BACKDIR/fs-before-R" -log_must eval "zfs receive -d -F $POOL2 < $BACKDIR/fs-before-R" -dstds=$(get_dst_ds $POOL/$FS $POOL2) -log_must cmp_ds_subs $POOL/$FS $dstds - -log_must verify_encryption_root $POOL/$FS $POOL/$FS -log_must verify_keylocation $POOL/$FS "prompt" -log_must verify_origin $POOL/$FS "-" - -log_must verify_encryption_root $POOL/clone $POOL/$FS +log_must eval "zfs receive -d -F $POOL2/fs2 < $BACKDIR/fs-before-R" +dstds=$(get_dst_ds $POOL/fs1/$FS $POOL2/fs2) +log_must cmp_ds_subs $POOL/fs1/$FS $dstds +#aaaaa +dstdsa=$(get_dst_ds $POOL/fs1/a $POOL2/fs2) +log_must cmp_ds_subs $POOL/fs1/a $dstdsa + +log_must verify_encryption_root $POOL/fs1/$FS $POOL/fs1/$FS +log_must verify_keylocation $POOL/fs1/$FS "prompt" +log_must verify_origin $POOL/fs1/$FS "-" +#aaaaa +log_must verify_encryption_root $POOL/fs1/a $POOL/fs1/a +log_must verify_keylocation $POOL/fs1/a "prompt" +log_must verify_origin $POOL/fs1/a "-" + +log_must verify_encryption_root $POOL/clone $POOL/fs1/$FS log_must verify_keylocation $POOL/clone "none" -log_must verify_origin $POOL/clone "$POOL/$FS@snap" - -log_must verify_encryption_root $POOL/$FS/child $POOL/$FS -log_must verify_keylocation $POOL/$FS/child "none" +log_must verify_origin $POOL/clone "$POOL/fs1/$FS@snap" +#aaaaa +log_must verify_encryption_root $POOL/clonea $POOL/fs1/a +log_must verify_keylocation $POOL/clonea "none" +log_must verify_origin $POOL/clonea "$POOL/fs1/a@snapa" + +log_must verify_encryption_root $POOL/fs1/$FS/child $POOL/fs1/$FS +log_must verify_keylocation $POOL/fs1/$FS/child "none" +#aaaaa +log_must verify_encryption_root $POOL/fs1/a/childa $POOL/fs1/a +log_must verify_keylocation $POOL/fs1/a/childa "none" # Alter the hierarchy and re-send log_must eval "echo $PASSPHRASE1 | zfs change-key -o keyformat=passphrase" \ - "$POOL/$FS/child" + "$POOL/fs1/$FS/child" log_must zfs promote $POOL/clone +#log_must zfs snapshot -r $POOL@after +#log_must eval "zfs send -wR -i $POOL@before $POOL@after >" \ +# "$BACKDIR/fs-after-R" +#log_must eval "zfs receive -d -F $POOL2/fs2 < $BACKDIR/fs-after-R" +#aaaaa +log_must eval "echo $PASSPHRASE1 | zfs change-key -o keyformat=passphrase" \ + "$POOL/fs1/a/childa" +log_must zfs promote $POOL/clonea log_must zfs snapshot -r $POOL@after log_must eval "zfs send -wR -i $POOL@before $POOL@after >" \ "$BACKDIR/fs-after-R" -log_must eval "zfs receive -d -F $POOL2 < $BACKDIR/fs-after-R" -log_must cmp_ds_subs $POOL/$FS $dstds +log_must eval "zfs receive -d -F $POOL2/fs2 < $BACKDIR/fs-after-R" +log_must cmp_ds_subs $POOL/fs1/$FS $dstds +log_must cmp_ds_subs $POOL/fs1/a $dstdsa -log_must verify_encryption_root $POOL/$FS $POOL/clone -log_must verify_keylocation $POOL/$FS "none" -log_must verify_origin $POOL/$FS "$POOL/clone@snap" +log_must verify_encryption_root $POOL/fs1/$FS $POOL/clone +log_must verify_keylocation $POOL/fs1/$FS "none" +log_must verify_origin $POOL/fs1/$FS "$POOL/clone@snap" +log_must verify_encryption_root $POOL/fs1/a $POOL/clonea +log_must verify_keylocation $POOL/fs1/a "none" +log_must verify_origin $POOL/fs1/a "$POOL/clonea@snapa" log_must verify_encryption_root $POOL/clone $POOL/clone log_must verify_keylocation $POOL/clone "prompt" log_must verify_origin $POOL/clone "-" +log_must verify_encryption_root $POOL/clonea $POOL/clonea +log_must verify_keylocation $POOL/clonea "prompt" +log_must verify_origin $POOL/clonea "-" + +log_must verify_encryption_root $POOL/fs1/$FS/child $POOL/fs1/$FS/child +log_must verify_keylocation $POOL/fs1/$FS/child "prompt" +log_must verify_encryption_root $POOL/fs1/a/childa $POOL/fs1/a/childa +log_must verify_keylocation $POOL/fs1/a/childa "prompt" -log_must verify_encryption_root $POOL/$FS/child $POOL/$FS/child -log_must verify_keylocation $POOL/$FS/child "prompt" +##### +log_must zfs list log_pass "Raw recursive sends preserve filesystem structure."