aboutsummaryrefslogtreecommitdiff
path: root/tests/zfs-tests/tests/functional/rsend/recv_dedup_encrypted_zvol.ksh
blob: 569fcd893e7d8f8b4471dcd89e12075938332344 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/ksh -p
#
# CDDL HEADER START
#
# 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.
#
# CDDL HEADER END
#

#
# Copyright (c) 2020 by Delphix. All rights reserved.
#

. $STF_SUITE/tests/functional/rsend/rsend.kshlib

#
# DESCRIPTION:
# Verifies that we can receive a dedup send stream of a zvol by processing it
# with "zstream redup".
#

verify_runnable "both"

function cleanup
{
	destroy_dataset $TESTPOOL/recv "-r"
	rm $sendfile
	rm $volfile
	rm $keyfile
}
log_onexit cleanup

log_assert "Verify zfs can receive raw, recursive, and deduplicated send streams"

typeset keyfile=/$TESTPOOL/pkey
typeset recvdev=$ZVOL_DEVDIR/$TESTPOOL/recv
typeset sendfile_compressed=$STF_SUITE/tests/functional/rsend/dedup_encrypted_zvol.zsend.bz2
typeset sendfile=/$TESTPOOL/dedup_encrypted_zvol.zsend
typeset volfile_compressed=$STF_SUITE/tests/functional/rsend/dedup_encrypted_zvol.bz2
typeset volfile=/$TESTPOOL/dedup_encrypted_zvol

log_must eval "echo 'password' > $keyfile"

log_must eval "bzcat <$sendfile_compressed >$sendfile"
log_must eval "zstream redup $sendfile | zfs recv $TESTPOOL/recv"

log_must zfs load-key $TESTPOOL/recv
block_device_wait

log_must eval "bzcat <$volfile_compressed >$volfile"
log_must diff $volfile $recvdev

log_pass "zfs can receive raw, recursive, and deduplicated send streams"