forked from opensearch-project/sql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbwctest.sh
executable file
·58 lines (50 loc) · 1.87 KB
/
bwctest.sh
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
#!/bin/bash
set -e
function usage() {
echo ""
echo "This script is used to run Backwards Compatibility tests"
echo "--------------------------------------------------------------------------"
echo "Usage: $0 [args]"
echo ""
echo "Required arguments:"
echo "None"
echo ""
echo -e "-h\tPrint this message."
echo "--------------------------------------------------------------------------"
}
while getopts ":h" arg; do
case $arg in
h)
usage
exit 1
;;
?)
echo "Invalid option: -${OPTARG}"
exit 1
;;
esac
done
# Place SQL artifact for the current version for bwc
function setup_bwc_artifact() {
# This gets opensearch version from build.gradle (e.g. 1.2.0-SNAPSHOT),
# then converts to plugin version by appending ".0" (e.g. 1.2.0.0-SNAPSHOT),
# assuming one line in build.gradle is 'opensearch_version= System.getProperty("opensearch.version", "<opensearch_version>")'.
plugin_version=$(grep 'opensearch_version = System.getProperty' build.gradle | \
grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+[^"]*' | sed -e 's/\([0-9]\)\([^0-9]*\)$/\1.0\2/')
plugin_artifact="./plugin/build/distributions/opensearch-sql-$plugin_version.zip"
bwc_artifact_dir="./integ-test/src/test/resources/bwc/$plugin_version"
if [ -z "${plugin_version// }" ]; then
echo "Error: failed to retrieve plugin version from build.gradle." >&2
exit 1
fi
# copy current artifact to bwc artifact directory if it's not there
if [ ! -f "$bwc_artifact_dir/opensearch-sql-$plugin_version.zip" ]; then
if [ ! -f "$plugin_artifact" ]; then
./gradlew assemble
fi
mkdir -p "$bwc_artifact_dir"
cp "$plugin_artifact" "$bwc_artifact_dir"
fi
}
setup_bwc_artifact
./gradlew bwcTestSuite -Dtests.security.manager=false