diff options
author | Shwetha K Acharya <sacharya@redhat.com> | 2020-02-13 16:57:13 +0530 |
---|---|---|
committer | Kotresh HR <khiremat@redhat.com> | 2020-04-27 05:47:21 +0000 |
commit | 2857fe3fad4d2b30894847088a54b847b88a23b9 (patch) | |
tree | 8fda95267634f1e96160b0460bd80387c4f7ae8a /tests/00-geo-rep | |
parent | f0fcd909ad4535b60c9208d4804ebe6afe421a09 (diff) |
extras: upgrade script for geo-rep
The patch https://review.gluster.org/#/c/glusterfs/+/23733/( which
optimizes the changelog) introduces change in dirctory structure
which is above changelog files.
Thus, before upgrade, old version should get updated, with respect
to the corresponding changes made by the above qouted patch.
This upgrade script,
1) creates a temp htime file, with updated paths from the htime file.
Updates temp htime file as htime file.
2) places the changelog files under the required directory structure.
Updates: #154
Change-Id: I4b5a6cb9a9266a65972b419b329bc958de8fdf8a
Signed-off-by: Shwetha K Acharya <sacharya@redhat.com>
Diffstat (limited to 'tests/00-geo-rep')
-rw-r--r-- | tests/00-geo-rep/georep-upgrade.t | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/tests/00-geo-rep/georep-upgrade.t b/tests/00-geo-rep/georep-upgrade.t new file mode 100644 index 00000000000..1084be482c4 --- /dev/null +++ b/tests/00-geo-rep/georep-upgrade.t @@ -0,0 +1,76 @@ +#!/bin/bash + +. $(dirname $0)/../include.rc + +SCRIPT_TIMEOUT=500 + +############################################################################################### +#Before upgrade +############################################################################################### +brick=/bricks/brick1 +epoch1=$(date '+%s') +sleep 1 +epoch2=$(date '+%s') +mkdir -p /bricks/brick1/.glusterfs/changelogs/htime +mkdir -p /bricks/brick1/.glusterfs/changelogs + +#multiple htime files(changelog enable/disable scenario) +TEST touch /bricks/brick1/.glusterfs/changelogs/htime/HTIME.$epoch1 +TEST touch /bricks/brick1/.glusterfs/changelogs/htime/HTIME.$epoch2 + +#changelog files +TEST touch /bricks/brick1/.glusterfs/changelogs/CHANGELOG.$epoch1 +TEST touch /bricks/brick1/.glusterfs/changelogs/CHANGELOG.$epoch2 + +htime_file1=/bricks/brick1/.glusterfs/changelogs/htime/HTIME.$epoch1 +htime_file2=/bricks/brick1/.glusterfs/changelogs/htime/HTIME.$epoch2 + +#data inside htime files before upgrade +data1=/bricks/brick1/.glusterfs/changelogs/CHANGELOG.$epoch1 +data2=/bricks/brick1/.glusterfs/changelogs/CHANGELOG.$epoch2 + +#data inside htime files after upgrade +updated_data1=/bricks/brick1/.glusterfs/changelogs/`echo $(date '+%Y/%m/%d')`/CHANGELOG.$epoch1 +updated_data2=/bricks/brick1/.glusterfs/changelogs/`echo $(date '+%Y/%m/%d')`/CHANGELOG.$epoch2 + +echo -n $data1>$htime_file1 +echo -n $data2>$htime_file2 + +echo "Before upgrade:" +EXPECT '1' echo $(grep $data1 $htime_file1 | wc -l) +EXPECT '1' echo $(grep $data2 $htime_file2 | wc -l) + +EXPECT '1' echo $(ls /bricks/brick1/.glusterfs/changelogs/CHANGELOG.$epoch1 | wc -l) +EXPECT '1' echo $(ls /bricks/brick1/.glusterfs/changelogs/htime/HTIME.$epoch1 | wc -l) +EXPECT '1' echo $(ls /bricks/brick1/.glusterfs/changelogs/CHANGELOG.$epoch2 | wc -l) +EXPECT '1' echo $(ls /bricks/brick1/.glusterfs/changelogs/htime/HTIME.$epoch2 | wc -l) +############################################################################################### +#Upgrade +############################################################################################### +TEST upgrade_script=$(find / -type f -name glusterfs-georep-upgrade.py) +TEST python3 $upgrade_script $brick + +############################################################################################### +#After upgrade +############################################################################################### +echo "After upgrade:" +EXPECT '1' echo $(grep $updated_data1 $htime_file1 | wc -l) +EXPECT '1' echo $(grep $updated_data2 $htime_file2 | wc -l) + +#Check directory structure inside changelogs +TEST ! ls /bricks/brick1/.glusterfs/changelogs/CHANGELOG.$epoch1 +EXPECT '1' echo $(ls /bricks/brick1/.glusterfs/changelogs/htime/HTIME.$epoch1 | wc -l) +EXPECT '1' echo $(ls /bricks/brick1/.glusterfs/changelogs/htime/HTIME.$epoch1.bak | wc -l) +EXPECT '1' echo $(ls /bricks/brick1/.glusterfs/changelogs/`echo $(date '+%Y')` | wc -l) +EXPECT '1' echo $(ls /bricks/brick1/.glusterfs/changelogs/`echo $(date '+%Y/%m')` | wc -l) +EXPECT '2' echo $(ls /bricks/brick1/.glusterfs/changelogs/`echo $(date '+%Y/%m/%d')` | wc -l) +EXPECT '1' echo $(ls /bricks/brick1/.glusterfs/changelogs/`echo $(date '+%Y/%m/%d')`/CHANGELOG.$epoch1 | wc -l) + +TEST ! ls /bricks/brick1/.glusterfs/changelogs/CHANGELOG.$epoch2 +EXPECT '1' echo $(ls /bricks/brick1/.glusterfs/changelogs/htime/HTIME.$epoch2 | wc -l) +EXPECT '1' echo $(ls /bricks/brick1/.glusterfs/changelogs/htime/HTIME.$epoch2.bak | wc -l) +EXPECT '1' echo $(ls /bricks/brick1/.glusterfs/changelogs/`echo $(date '+%Y')` | wc -l) +EXPECT '1' echo $(ls /bricks/brick1/.glusterfs/changelogs/`echo $(date '+%Y/%m')`| wc -l) +EXPECT '1' echo $(ls /bricks/brick1/.glusterfs/changelogs/`echo $(date '+%Y/%m/%d')`/CHANGELOG.$epoch2 | wc -l) + +TEST rm -rf /bricks |