summaryrefslogtreecommitdiffstats
path: root/tests/basic/cdc.t
diff options
context:
space:
mode:
Diffstat (limited to 'tests/basic/cdc.t')
-rwxr-xr-xtests/basic/cdc.t41
1 files changed, 28 insertions, 13 deletions
diff --git a/tests/basic/cdc.t b/tests/basic/cdc.t
index 70d2171a84d..8653a77207a 100755
--- a/tests/basic/cdc.t
+++ b/tests/basic/cdc.t
@@ -5,6 +5,11 @@
cleanup;
+function file_mime_type () {
+ mime_type=$(file --mime $1 2>/dev/null | sed '/^[^:]*: /s///')
+ echo $mime_type
+}
+
TEST glusterd
TEST pidof glusterd
@@ -44,22 +49,30 @@ EXPECT 'Started' volinfo_field $V0 'Status';
sleep 2
## Mount FUSE with caching disabled
-TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 $M0;
+TEST $GFS -s $H0 --volfile-id $V0 $M0;
####################
## Testing writev ##
####################
## Create a 1K file locally and find the md5sum
-TEST dd if=/dev/zero of=/tmp/cdc-orig count=1 bs=1K 2>/dev/null
+TEST dd if=/dev/zero of=/tmp/cdc-orig count=1 bs=1k 2>/dev/null
checksum[original-file]=`md5sum /tmp/cdc-orig | cut -d' ' -f1`
## Copy the file to mountpoint and find its md5sum on brick
-TEST dd if=/tmp/cdc-orig of=$M0/cdc-server count=1 bs=1K 2>/dev/null
+TEST dd if=/tmp/cdc-orig of=$M0/cdc-server count=1 bs=1k 2>/dev/null
checksum[brick-file]=`md5sum $B0/${V0}1/cdc-server | cut -d' ' -f1`
## Uncompress the gzip dump file and find its md5sum
-EXPECT '/tmp/cdcdump.gz: application/x-gzip; charset=binary' file -i /tmp/cdcdump.gz
+# mime outputs for gzip are different for file version > 5.14
+TEST touch /tmp/gzipfile
+TEST gzip /tmp/gzipfile
+GZIP_MIME_TYPE=$(file_mime_type /tmp/gzipfile.gz)
+
+TEST rm -f /tmp/gzipfile.gz
+
+EXPECT "$GZIP_MIME_TYPE" echo $(file_mime_type /tmp/cdcdump.gz)
+
TEST gunzip -f /tmp/cdcdump.gz
checksum[dump-file-writev]=`md5sum /tmp/cdcdump | cut -d' ' -f1`
@@ -75,11 +88,13 @@ TEST rm -f /tmp/cdcdump.gz
###################
## Copy file from mount point to client and find checksum
-TEST dd if=$M0/cdc-server of=/tmp/cdc-client count=1 bs=1K 2>/dev/null
+TEST dd if=$M0/cdc-server of=/tmp/cdc-client count=1 bs=1k 2>/dev/null
checksum[client-file]=`md5sum /tmp/cdc-client | cut -d' ' -f1`
## Uncompress the gzip dump file and find its md5sum
-EXPECT '/tmp/cdcdump.gz: application/x-gzip; charset=binary' file -i /tmp/cdcdump.gz
+# mime outputs for gzip are different for file version > 5.14
+EXPECT "$GZIP_MIME_TYPE" echo $(file_mime_type /tmp/cdcdump.gz)
+
TEST gunzip -f /tmp/cdcdump.gz
checksum[dump-file-readv]=`md5sum /tmp/cdcdump | cut -d' ' -f1`
@@ -89,7 +104,7 @@ TEST test ${checksum[client-file]} = ${checksum[dump-file-readv]}
## Cleanup files and unmount
TEST rm -f /tmp/cdc* $M0/cdc*
-TEST umount $M0
+EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0
## Stop the volume
TEST $CLI volume stop $V0;
@@ -106,7 +121,7 @@ TEST $CLI volume start $V0;
EXPECT 'Started' volinfo_field $V0 'Status';
## Mount FUSE with caching disabled
-TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 $M0;
+TEST $GFS -s $H0 --volfile-id $V0 $M0;
## Create a file of size 99 bytes on mountpoint
## This is should not be compressed
@@ -115,17 +130,17 @@ TEST ! test -e /tmp/cdcdump.gz
## Cleanup files and unmount
TEST rm -f /tmp/cdc* $M0/cdc*
-TEST umount $M0
+EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0
+
+## Stop the volume
+TEST $CLI volume stop $V0;
+EXPECT 'Stopped' volinfo_field $V0 'Status';
## Reset the network.compression options
TEST $CLI volume reset $V0 network.compression.debug
TEST $CLI volume reset $V0 network.compression.min-size
TEST $CLI volume reset $V0 network.compression
-## 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;