summaryrefslogtreecommitdiffstats
path: root/tests/encryption/crypt.t
diff options
context:
space:
mode:
authorJeff Darcy <jdarcy@redhat.com>2014-03-04 14:42:40 +0000
committerJeff Darcy <jdarcy@redhat.com>2014-03-04 14:42:40 +0000
commit0de07f4189cbd191a765c60ed3d7c72f72112e68 (patch)
tree83781a0df06c9110c6f3db12caad23ea00832b53 /tests/encryption/crypt.t
parentc28972ea53cc7cdb91c7aac01754dd7f0b66e1a7 (diff)
parent9f45d0f6212d6d5c96dafc4aba73d9d12b39c3d6 (diff)
Merge branch 'upstream' into merge
Signed-off-by: Jeff Darcy <jdarcy@redhat.com> Conflicts: api/src/glfs-fops.c libglusterfs/src/syncop.c libglusterfs/src/syncop.h Change-Id: I8c3fa7a20fb167d9e6bc2749e177c0c8b366827b
Diffstat (limited to 'tests/encryption/crypt.t')
-rwxr-xr-xtests/encryption/crypt.t87
1 files changed, 87 insertions, 0 deletions
diff --git a/tests/encryption/crypt.t b/tests/encryption/crypt.t
new file mode 100755
index 000000000..aa46bd429
--- /dev/null
+++ b/tests/encryption/crypt.t
@@ -0,0 +1,87 @@
+#!/bin/bash
+
+. $(dirname $0)/../include.rc
+. $(dirname $0)/../volume.rc
+
+cleanup;
+
+TEST glusterd
+TEST pidof glusterd
+
+## Create a volume with one brick
+TEST $CLI volume create $V0 $H0:$B0/${V0}1;
+EXPECT "$V0" volinfo_field $V0 'Volume Name';
+EXPECT 'Created' volinfo_field $V0 'Status';
+EXPECT '1' brick_count $V0
+
+## Turn off performance translators
+
+TEST $CLI volume set $V0 performance.quick-read off
+EXPECT 'off' volinfo_field $V0 'performance.quick-read'
+TEST $CLI volume set $V0 performance.write-behind off
+EXPECT 'off' volinfo_field $V0 'performance.write-behind'
+TEST $CLI volume set $V0 performance.open-behind off
+EXPECT 'off' volinfo_field $V0 'performance.open-behind'
+
+## Turn on crypt xlator by setting features.encryption to on
+TEST $CLI volume set $V0 encryption on
+EXPECT 'on' volinfo_field $V0 'features.encryption'
+
+## Specify location of master key
+TEST $CLI volume set $V0 encryption.master-key /tmp/$V0-master-key
+
+## Create a file with master key
+
+echo "0000111122223333444455556666777788889999aaaabbbbccccddddeeeeffff" > /tmp/$V0-master-key
+
+## Start the volume
+TEST $CLI volume start $V0;
+EXPECT 'Started' volinfo_field $V0 'Status';
+
+## Mount the volume
+TEST glusterfs --volfile-server=$H0 --volfile-id=$V0 $M0;
+
+## Testing writev, readv, ftruncate:
+## Create fragmented files and compare them with the reference files
+
+build_tester $(dirname $0)/frag.c
+TEST $(dirname $0)/frag $M0/testfile /tmp/$V0-goodfile 262144 500
+
+## Testing link, unlink, symlink, rename
+
+TEST ln $M0/testfile $M0/testfile-link
+TEST mv $M0/testfile $M0/testfile-renamed
+TEST ln -s $M0/testfile-link $M0/testfile-symlink
+TEST rm -f $M0/testfile-renamed
+
+## Remount the volume
+TEST umount $M0
+TEST glusterfs --volfile-server=$H0 --volfile-id=$V0 $M0;
+
+TEST diff -u $M0/testfile-symlink /tmp/$V0-goodfile
+EXPECT ''
+
+TEST rm -f $M0/testfile-symlink
+TEST rm -f $M0/testfile-link
+
+## Cleanup files
+
+TEST rm -f /tmp/$V0-master-key
+TEST rm -f /tmp/$V0-goodfile
+
+TEST umount $M0
+
+## Reset crypt options
+TEST $CLI volume reset $V0 encryption.block-size
+TEST $CLI volume reset $V0 encryption.data-key-size
+
+## Stop the volume
+TEST $CLI volume stop $V0;
+EXPECT 'Stopped' volinfo_field $V0 'Status';
+
+## Delete the volume
+TEST $CLI volume delete $V0;
+TEST ! $CLI volume info $V0;
+
+TEST rm -rf $(dirname $0)/frag
+cleanup;