Skip to content

Commit 999b659

Browse files
grahamcsnajpa
authored andcommitted
channel program: test that encryption properties are gettable
It appears that the current behavior is broken: * 'encryption' always being "off" * 'encryptionroot' always being null Signed-off-by: Graham Christensen <[email protected]> Merging notes from snajpa: - added SPDX tags - rebased (tests/zfs-tests/tests/Makefile.am) Signed-off-by: Pavel Snajdr <[email protected]>
1 parent 55a30d5 commit 999b659

File tree

5 files changed

+69
-2
lines changed

5 files changed

+69
-2
lines changed

tests/runfiles/common.run

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ tests = ['case_all_values', 'norm_all_values', 'mixed_create_failure',
119119
tags = ['functional', 'casenorm']
120120

121121
[tests/functional/channel_program/lua_core]
122-
tests = ['tst.args_to_lua', 'tst.divide_by_zero', 'tst.exists',
122+
tests = ['tst.args_to_lua', 'tst.divide_by_zero', 'tst.exists', 'tst.encryption',
123123
'tst.integer_illegal', 'tst.integer_overflow', 'tst.language_functions_neg',
124124
'tst.language_functions_pos', 'tst.large_prog', 'tst.libraries',
125125
'tst.memory_limit', 'tst.nested_neg', 'tst.nested_pos', 'tst.nvlist_to_lua',

tests/runfiles/sanity.run

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ tests = ['case_all_values', 'norm_all_values', 'sensitive_none_lookup',
6464
tags = ['functional', 'casenorm']
6565

6666
[tests/functional/channel_program/lua_core]
67-
tests = ['tst.args_to_lua', 'tst.divide_by_zero', 'tst.exists',
67+
tests = ['tst.args_to_lua', 'tst.divide_by_zero', 'tst.exists', 'tst.encryption',
6868
'tst.integer_illegal', 'tst.integer_overflow', 'tst.language_functions_neg',
6969
'tst.language_functions_pos', 'tst.large_prog', 'tst.libraries',
7070
'tst.memory_limit', 'tst.nested_neg', 'tst.nested_pos', 'tst.nvlist_to_lua',

tests/zfs-tests/tests/Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ nobase_dist_datadir_zfs_tests_tests_DATA += \
106106
functional/channel_program/lua_core/tst.args_to_lua.zcp \
107107
functional/channel_program/lua_core/tst.divide_by_zero.err \
108108
functional/channel_program/lua_core/tst.divide_by_zero.zcp \
109+
functional/channel_program/lua_core/tst.encryption.zcp \
109110
functional/channel_program/lua_core/tst.exists.zcp \
110111
functional/channel_program/lua_core/tst.large_prog.out \
111112
functional/channel_program/lua_core/tst.large_prog.zcp \
@@ -543,6 +544,7 @@ nobase_dist_datadir_zfs_tests_tests_SCRIPTS += \
543544
functional/channel_program/lua_core/setup.ksh \
544545
functional/channel_program/lua_core/tst.args_to_lua.ksh \
545546
functional/channel_program/lua_core/tst.divide_by_zero.ksh \
547+
functional/channel_program/lua_core/tst.encryption.ksh \
546548
functional/channel_program/lua_core/tst.exists.ksh \
547549
functional/channel_program/lua_core/tst.integer_illegal.ksh \
548550
functional/channel_program/lua_core/tst.integer_overflow.ksh \
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/ksh -p
2+
# SPDX-License-Identifier: CDDL-1.0
3+
#
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
7+
# 1.0 of the CDDL.
8+
#
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.
12+
#
13+
14+
#
15+
# Copyright (c) 2021 by Determinate Systems. All rights reserved.
16+
#
17+
18+
. $STF_SUITE/tests/functional/channel_program/channel_common.kshlib
19+
20+
#
21+
# DESCRIPTION:
22+
# zfs.exists should accurately report whether a dataset exists, and
23+
# report an error if a dataset is in another pool.
24+
25+
verify_runnable "global"
26+
27+
TESTDATASET="channelprogramencryption"
28+
29+
passphrase="password"
30+
log_must eval "echo "$passphrase" | zfs create -o encryption=aes-256-ccm " \
31+
"-o keyformat=passphrase $TESTPOOL/$TESTDATASET"
32+
33+
function cleanup
34+
{
35+
datasetexists $TESTPOOL/$TESTDATASET && \
36+
log_must zfs destroy -R $TESTPOOL/$TESTDATASET
37+
}
38+
39+
log_must_program $TESTPOOL $ZCP_ROOT/lua_core/tst.encryption.zcp \
40+
$TESTPOOL/$TESTDATASET
41+
42+
log_pass "zfs.get_prop(dataset, ...) on \"encryption\" and \"encryptionroot\" gives correct results"
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
-- SPDX-License-Identifier: CDDL-1.0
2+
--
3+
-- This file and its contents are supplied under the terms of the
4+
-- Common Development and Distribution License ("CDDL"), version 1.0.
5+
-- You may only use this file in accordance with the terms of version
6+
-- 1.0 of the CDDL.
7+
--
8+
-- A full copy of the text of the CDDL should have accompanied this
9+
-- source. A copy of the CDDL is also available via the Internet at
10+
-- http://www.illumos.org/license/CDDL.
11+
--
12+
13+
--
14+
-- Copyright (c) 2021 by Determinate Systems. All rights reserved.
15+
--
16+
17+
-- ensure zfs.get_prop returns the correct values for "encryption"
18+
-- and "encryptionroot"
19+
20+
args = ...
21+
argv = args['argv']
22+
assert(zfs.get_prop(argv[1], "encryption") == "aes-256-ccm")
23+
assert(zfs.get_prop(argv[1], "encryptionroot") == argv[1])

0 commit comments

Comments
 (0)