Skip to content

Commit

Permalink
tests/br/compatibility: fix failed for manifest unknown (pingcap#1161) (
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Jun 10, 2021
1 parent 55fb11a commit 5fcf445
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
20 changes: 20 additions & 0 deletions compatibility/get_last_tags.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# update tags
git fetch --tags

getLatestTags() {
release_5_branch_regex="^release-5\.[0-9].*$"
release_4_branch_regex="^release-4\.[0-9].*$"
TOTAL_TAGS=$(git for-each-ref --sort=creatordate refs/tags | awk -F '/' '{print $3}')
filter='alpha'
# latest tags
TAGS=$(echo $TOTAL_TAGS | tr ' ' '\n' | grep -v $filter | tail -n3)
if git rev-parse --abbrev-ref HEAD | egrep -q $release_5_branch_regex
then
# If we are in release-5.0 branch, try to use latest 3 version of 5.x and last 4.x version
TAGS=$(echo $TOTAL_TAGS | tr ' ' '\n' | fgrep "v4." | grep -v $filter | tail -n1 && echo $TOTAL_TAGS | tr ' ' '\n' | fgrep "v5." | grep -v $filter | tail -n3)
elif git rev-parse --abbrev-ref HEAD | egrep -q $release_4_branch_regex
then
# If we are in release-4.0 branch, try to use latest 3 version of 4.x
TAGS=$(echo $TOTAL_TAGS | tr ' ' '\n' | fgrep "v4." | grep -v $filter | tail -n3)
fi
}
20 changes: 1 addition & 19 deletions compatibility/prepare_backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,9 @@

set -eux

# update tags
git fetch --tags
. compatibility/get_last_tags.sh

TAGS="v5.0.0"
getLatestTags() {
release_5_branch_regex="^release-5\.[0-9].*$"
release_4_branch_regex="^release-4\.[0-9].*$"
TOTAL_TAGS=$(git for-each-ref --sort=creatordate refs/tags | awk -F '/' '{print $3}')
# latest tags
TAGS=$(echo $TOTAL_TAGS | tr ' ' '\n' | tail -n3)
if git rev-parse --abbrev-ref HEAD | egrep -q $release_5_branch_regex
then
# If we are in release-5.0 branch, try to use latest 3 version of 5.x and last 4.x version
TAGS=$(echo $TOTAL_TAGS | tr ' ' '\n' | fgrep "v4." | tail -n1 && echo $TOTAL_TAGS | tr ' ' '\n' | fgrep "v5." | tail -n3)
elif git rev-parse --abbrev-ref HEAD | egrep -q $release_4_branch_regex
then
# If we are in release-4.0 branch, try to use latest 3 version of 4.x
TAGS=$(echo $TOTAL_TAGS | tr ' ' '\n' | fgrep "v4." | tail -n3)
fi
}

getLatestTags
echo "recent version of cluster is $TAGS"

Expand Down
3 changes: 2 additions & 1 deletion tests/run_compatible.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@

set -eu

source ${BASH_SOURCE[0]%/*}/../compatibility/prepare_backup.sh
source ${BASH_SOURCE[0]%/*}/../compatibility/get_last_tags.sh
getLatestTags
echo "start test on $TAGS"

EXPECTED_KVS=1000
Expand Down

0 comments on commit 5fcf445

Please sign in to comment.