Skip to content

Commit e676e00

Browse files
ananzhMiki
authored and
Miki
committed
add a script to run bwc test (opensearch-project#879)
* add a script to run bwc test This script is used to run bwc tests on a remote cluster. It will first pull opensearch-dashboards-functional-test repo in a tmp folder. Then move the required cypress tests in and run the bwc tests. partically solved: opensearch-project/opensearch-build#705 Signed-off-by: Anan Zhuang <[email protected]> * change file name to match opensearch-build script_finder. Signed-off-by: Anan Zhuang <[email protected]>
1 parent 3655613 commit e676e00

File tree

1 file changed

+99
-0
lines changed

1 file changed

+99
-0
lines changed

bwctest.sh

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
function usage() {
6+
echo ""
7+
echo "This script is used to run bwc tests on a remote OpenSearch/Dashboards cluster."
8+
echo "--------------------------------------------------------------------------"
9+
echo "Usage: $0 [args]"
10+
echo ""
11+
echo "Required arguments:"
12+
echo "None"
13+
echo ""
14+
echo "Optional arguments:"
15+
echo -e "-a BIND_ADDRESS\t, defaults to localhost | 127.0.0.1, can be changed to any IP or domain name for the cluster location."
16+
echo -e "-p BIND_PORT\t, defaults to 9200 or 5601 depends on OpenSearch or Dashboards, can be changed to any port for the cluster location."
17+
echo -e "-b BUNDLED_OSD\t(true | false), defaults to true. Specify the usage of bundled Dashboards or not."
18+
echo -e "-c CREDENTIAL\t(usename:password), no defaults, effective when SECURITY_ENABLED=true."
19+
echo -e "-h\tPrint this message."
20+
echo "--------------------------------------------------------------------------"
21+
}
22+
23+
while getopts ":ha:p:b:c:" arg; do
24+
case $arg in
25+
h)
26+
usage
27+
exit 1
28+
;;
29+
a)
30+
BIND_ADDRESS=$OPTARG
31+
;;
32+
p)
33+
BIND_PORT=$OPTARG
34+
;;
35+
b)
36+
BUNDLED_OSD=$OPTARG
37+
;;
38+
c)
39+
CREDENTIAL=$OPTARG
40+
;;
41+
:)
42+
echo "-${OPTARG} requires an argument"
43+
usage
44+
exit 1
45+
;;
46+
?)
47+
echo "Invalid option: -${OPTARG}"
48+
exit 1
49+
;;
50+
esac
51+
done
52+
53+
54+
if [ -z "$BIND_ADDRESS" ]
55+
then
56+
BIND_ADDRESS="localhost"
57+
fi
58+
59+
if [ -z "$BIND_PORT" ]
60+
then
61+
BIND_PORT="5601"
62+
fi
63+
64+
if [ -z "$BUNDLED_OSD" ]
65+
then
66+
BUNDLED_OSD="true"
67+
fi
68+
69+
if [ -z "$CREDENTIAL" ]
70+
then
71+
CREDENTIAL="admin:admin"
72+
USERNAME=`echo $CREDENTIAL | awk -F ':' '{print $1}'`
73+
PASSWORD=`echo $CREDENTIAL | awk -F ':' '{print $2}'`
74+
fi
75+
76+
cwd=$(pwd)
77+
dir="bwc-tmp"
78+
if [ -d "$dir" ]; then
79+
rm -rf "$dir"
80+
echo "bwc-tmp exists and needs to be removed"
81+
fi
82+
83+
mkdir "$dir"
84+
git clone https://github.com/opensearch-project/opensearch-dashboards-functional-test "$dir"
85+
rm -rf "$dir/cypress"
86+
cp -r cypress "$dir"
87+
cd "$dir"
88+
89+
npm install
90+
91+
if [ $BUNDLED_OSD = "true" ]
92+
then
93+
echo "run security enabled tests"
94+
npx cypress run --spec "$cwd/bwc-tmp/cypress/integration/bundled-osd/*.js"
95+
else
96+
npx cypress run --spec "$cwd/bwc-tmp/cypress/integration/osd/*.js"
97+
fi
98+
99+
rm -rf "$cwd/$dir"

0 commit comments

Comments
 (0)