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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
#!/bin/bash
. $(dirname $0)/../include.rc
. $(dirname $0)/../volume.rc
. $(dirname $0)/../env.rc
SCRIPT_TIMEOUT=300
##Cleanup and start glusterd
cleanup;
TEST glusterd;
TEST pidof glusterd
##create .keys
mkdir -p /var/lib/glusterd/glusterfind/.keys
#create_and_start test_volume
TEST $CLI volume create test-vol $H0:$B0/b1 $H0:$B0/b2 $H0:$B0/b3
TEST gluster volume start test-vol
##Mount test-vol
TEST glusterfs -s $H0 --volfile-id test-vol $M0
TEST timestamp1=$(date +'%s')
##Create files and dirs inside the mount point
TEST mkdir -p $M0/dir1
TEST touch $M0/file1
##Glusterfind Create
TEST glusterfind create sess_vol1 test-vol --force
##################################################################################
#Incremental crawl
##################################################################################
##Glusterfind Pre
TEST glusterfind pre sess_vol1 test-vol output_file.txt
#Glusterfind Post
TEST glusterfind post sess_vol1 test-vol
##Glusterfind List
EXPECT '1' echo $(glusterfind list | grep sess_vol1 | wc -l)
TEST timestamp2=$(date +'%s')
##Glusterfind Query
TEST glusterfind query test-vol --since-time $timestamp1 --end-time $timestamp2 output_file.txt
#################################################################################
#Full Crawl
#################################################################################
##Glusterfind Pre
TEST glusterfind pre sess_vol1 test-vol output_file.txt --full --regenerate-outfile
EXPECT '1' echo $(grep 'NEW dir1' output_file.txt | wc -l)
EXPECT '1' echo $(grep 'NEW file1' output_file.txt | wc -l)
##Glusterfind Query commands
TEST glusterfind query test-vol --full output_file.txt
EXPECT '1' echo $(grep 'NEW dir1' output_file.txt | wc -l)
EXPECT '1' echo $(grep 'NEW file1' output_file.txt | wc -l)
##using tag, full crawl
TEST glusterfind query test-vol --full --tag-for-full-find NEW output_file.txt
EXPECT '1' echo $(grep 'NEW dir1' output_file.txt | wc -l)
EXPECT '1' echo $(grep 'NEW file1' output_file.txt | wc -l)
##using -field-separator option, full crawl
glusterfind query test-vol --full output_file.txt --field-separator "=="
EXPECT '1' echo $(grep 'NEW==dir1' output_file.txt | wc -l)
EXPECT '1' echo $(grep 'NEW==file1' output_file.txt | wc -l)
##Adding or Replacing a Brick from an Existing Glusterfind Session
TEST gluster volume add-brick test-vol $H0:$B0/b4 force
##To make existing session work after brick add
TEST glusterfind create sess_vol test-vol --force
EXPECT '1' echo $(glusterfind list | grep sess_vol1 | wc -l)
##glusterfind delete
TEST glusterfind delete sess_vol test-vol
rm -rf output_file.txt
cleanup;
|