Files
tidb/tests/_utils/check_cluster_version
2024-04-02 04:24:23 +00:00

28 lines
994 B
Bash
Executable File

#!/bin/sh
#
# Copyright 2020 PingCAP, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -eu
if [ "$CLUSTER_VERSION_MAJOR" -gt "$1" ] || ([ "$CLUSTER_VERSION_MAJOR" -eq "$1" ] && ( \
[ "$CLUSTER_VERSION_MINOR" -gt "$2" ] || \
[ "$CLUSTER_VERSION_MINOR" -eq "$2" ] && [ "$CLUSTER_VERSION_REVISION" -ge "$3" ] ))
then
exit 0
fi
echo "$4 requires v$1.$2.$3, but current cluster is v$CLUSTER_VERSION_MAJOR.$CLUSTER_VERSION_MINOR.$CLUSTER_VERSION_REVISION. Skipping test."
exit 1