"Fossies" - the Fresh Open Source Software Archive

Member "glusterfs-8.6/tests/00-geo-rep/georep-upgrade.t" (20 Aug 2021, 3684 Bytes) of package /linux/misc/glusterfs-8.6.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "georep-upgrade.t": 9.3_vs_9.4.

    1 #!/bin/bash
    2 
    3 . $(dirname $0)/../include.rc
    4 
    5 SCRIPT_TIMEOUT=500
    6 
    7 ###############################################################################################
    8 #Before upgrade
    9 ###############################################################################################
   10 brick=/bricks/brick1
   11 epoch1=$(date '+%s')
   12 sleep 1
   13 epoch2=$(date '+%s')
   14 mkdir -p /bricks/brick1/.glusterfs/changelogs/htime
   15 mkdir -p /bricks/brick1/.glusterfs/changelogs
   16 
   17 #multiple htime files(changelog enable/disable scenario)
   18 TEST touch /bricks/brick1/.glusterfs/changelogs/htime/HTIME.$epoch1
   19 TEST touch /bricks/brick1/.glusterfs/changelogs/htime/HTIME.$epoch2
   20 
   21 #changelog files
   22 TEST touch /bricks/brick1/.glusterfs/changelogs/CHANGELOG.$epoch1
   23 TEST touch /bricks/brick1/.glusterfs/changelogs/CHANGELOG.$epoch2
   24 
   25 htime_file1=/bricks/brick1/.glusterfs/changelogs/htime/HTIME.$epoch1
   26 htime_file2=/bricks/brick1/.glusterfs/changelogs/htime/HTIME.$epoch2
   27 
   28 #data inside htime files before upgrade
   29 data1=/bricks/brick1/.glusterfs/changelogs/CHANGELOG.$epoch1
   30 data2=/bricks/brick1/.glusterfs/changelogs/CHANGELOG.$epoch2
   31 
   32 #data inside htime files after upgrade
   33 updated_data1=/bricks/brick1/.glusterfs/changelogs/`echo $(date '+%Y/%m/%d')`/CHANGELOG.$epoch1
   34 updated_data2=/bricks/brick1/.glusterfs/changelogs/`echo $(date '+%Y/%m/%d')`/CHANGELOG.$epoch2
   35 
   36 echo -n $data1>$htime_file1
   37 echo -n $data2>$htime_file2
   38 
   39 echo "Before upgrade:"
   40 EXPECT '1' echo $(grep $data1 $htime_file1 | wc -l)
   41 EXPECT '1' echo $(grep $data2 $htime_file2 | wc -l)
   42 
   43 EXPECT '1' echo $(ls /bricks/brick1/.glusterfs/changelogs/CHANGELOG.$epoch1 | wc -l)
   44 EXPECT '1' echo $(ls /bricks/brick1/.glusterfs/changelogs/htime/HTIME.$epoch1 | wc -l)
   45 EXPECT '1' echo $(ls /bricks/brick1/.glusterfs/changelogs/CHANGELOG.$epoch2 | wc -l)
   46 EXPECT '1' echo $(ls /bricks/brick1/.glusterfs/changelogs/htime/HTIME.$epoch2 | wc -l)
   47 ###############################################################################################
   48 #Upgrade
   49 ###############################################################################################
   50 TEST python3 extras/glusterfs-georep-upgrade.py $brick
   51 
   52 ###############################################################################################
   53 #After upgrade
   54 ###############################################################################################
   55 echo "After upgrade:"
   56 EXPECT '1' echo $(grep $updated_data1 $htime_file1 | wc -l)
   57 EXPECT '1' echo $(grep $updated_data2 $htime_file2 | wc -l)
   58 
   59 #Check directory structure inside changelogs
   60 TEST ! ls /bricks/brick1/.glusterfs/changelogs/CHANGELOG.$epoch1
   61 EXPECT '1' echo $(ls /bricks/brick1/.glusterfs/changelogs/htime/HTIME.$epoch1 | wc -l)
   62 EXPECT '1' echo $(ls /bricks/brick1/.glusterfs/changelogs/htime/HTIME.$epoch1.bak | wc -l)
   63 EXPECT '1' echo $(ls /bricks/brick1/.glusterfs/changelogs/`echo $(date '+%Y')` | wc -l)
   64 EXPECT '1' echo $(ls /bricks/brick1/.glusterfs/changelogs/`echo $(date '+%Y/%m')` | wc -l)
   65 EXPECT '2' echo $(ls /bricks/brick1/.glusterfs/changelogs/`echo $(date '+%Y/%m/%d')` | wc -l)
   66 EXPECT '1' echo $(ls /bricks/brick1/.glusterfs/changelogs/`echo $(date '+%Y/%m/%d')`/CHANGELOG.$epoch1 | wc -l)
   67 
   68 TEST ! ls /bricks/brick1/.glusterfs/changelogs/CHANGELOG.$epoch2
   69 EXPECT '1' echo $(ls /bricks/brick1/.glusterfs/changelogs/htime/HTIME.$epoch2 | wc -l)
   70 EXPECT '1' echo $(ls /bricks/brick1/.glusterfs/changelogs/htime/HTIME.$epoch2.bak | wc -l)
   71 EXPECT '1' echo $(ls /bricks/brick1/.glusterfs/changelogs/`echo $(date '+%Y')` | wc -l)
   72 EXPECT '1' echo $(ls /bricks/brick1/.glusterfs/changelogs/`echo $(date '+%Y/%m')`| wc -l)
   73 EXPECT '1' echo $(ls /bricks/brick1/.glusterfs/changelogs/`echo $(date '+%Y/%m/%d')`/CHANGELOG.$epoch2 | wc -l)
   74 
   75 TEST rm -rf /bricks