Skip to content

Commit 4a2448f

Browse files
Add integtest.sh to specifically run integTestRemote task (#1456)
Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>
1 parent 31fddb6 commit 4a2448f

File tree

1 file changed

+107
-0
lines changed

1 file changed

+107
-0
lines changed

scripts/integtest.sh

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
#!/bin/bash
2+
3+
# Copyright OpenSearch Contributors
4+
# SPDX-License-Identifier: Apache-2.0
5+
#
6+
# The OpenSearch Contributors require contributions made to
7+
# this file be licensed under the Apache-2.0 license or a
8+
# compatible open source license.
9+
10+
11+
set -e
12+
13+
function usage() {
14+
echo ""
15+
echo "This script is used to run integration tests for plugin installed on a remote OpenSearch/Dashboards cluster."
16+
echo "--------------------------------------------------------------------------"
17+
echo "Usage: $0 [args]"
18+
echo ""
19+
echo "Required arguments:"
20+
echo "None"
21+
echo ""
22+
echo "Optional arguments:"
23+
echo -e "-b BIND_ADDRESS\t, defaults to localhost | 127.0.0.1, can be changed to any IP or domain name for the cluster location."
24+
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."
25+
echo -e "-s SECURITY_ENABLED\t(true | false), defaults to true. Specify the OpenSearch/Dashboards have security enabled or not."
26+
echo -e "-c CREDENTIAL\t(usename:password), no defaults, effective when SECURITY_ENABLED=true."
27+
echo -e "-v OPENSEARCH_VERSION\t, no defaults"
28+
echo -e "-n SNAPSHOT\t, defaults to false"
29+
echo -e "-h\tPrint this message."
30+
echo "--------------------------------------------------------------------------"
31+
}
32+
33+
while getopts ":hb:p:s:c:v:n:" arg; do
34+
case $arg in
35+
h)
36+
usage
37+
exit 1
38+
;;
39+
b)
40+
BIND_ADDRESS=$OPTARG
41+
;;
42+
p)
43+
BIND_PORT=$OPTARG
44+
;;
45+
s)
46+
SECURITY_ENABLED=$OPTARG
47+
;;
48+
c)
49+
CREDENTIAL=$OPTARG
50+
;;
51+
v)
52+
OPENSEARCH_VERSION=$OPTARG
53+
;;
54+
n)
55+
SNAPSHOT=$OPTARG
56+
;;
57+
:)
58+
echo "-${OPTARG} requires an argument"
59+
usage
60+
exit 1
61+
;;
62+
?)
63+
echo "Invalid option: -${OPTARG}"
64+
exit 1
65+
;;
66+
esac
67+
done
68+
69+
70+
if [ -z "$BIND_ADDRESS" ]
71+
then
72+
BIND_ADDRESS="localhost"
73+
fi
74+
75+
if [ -z "$BIND_PORT" ]
76+
then
77+
BIND_PORT="9200"
78+
fi
79+
80+
if [ -z "$SECURITY_ENABLED" ]
81+
then
82+
SECURITY_ENABLED="true"
83+
fi
84+
85+
if [ -z "$SNAPSHOT" ]
86+
then
87+
SNAPSHOT="false"
88+
fi
89+
90+
OPENSEARCH_REQUIRED_VERSION="2.12.0"
91+
if [ -z "$CREDENTIAL" ]
92+
then
93+
# Starting in 2.12.0, security demo configuration script requires an initial admin password
94+
COMPARE_VERSION=`echo $OPENSEARCH_REQUIRED_VERSION $OPENSEARCH_VERSION | tr ' ' '\n' | sort -V | uniq | head -n 1`
95+
if [ "$COMPARE_VERSION" != "$OPENSEARCH_REQUIRED_VERSION" ]; then
96+
CREDENTIAL="admin:admin"
97+
else
98+
CREDENTIAL="admin:myStrongPassword123!"
99+
fi
100+
fi
101+
102+
USERNAME=`echo $CREDENTIAL | awk -F ':' '{print $1}'`
103+
PASSWORD=`echo $CREDENTIAL | awk -F ':' '{print $2}'`
104+
105+
set -x
106+
107+
./gradlew integTestRemote -Dopensearch.version=$OPENSEARCH_VERSION -Dbuild.snapshot=$SNAPSHOT -Dtests.rest.cluster="$BIND_ADDRESS:$BIND_PORT" -Dtests.cluster="$BIND_ADDRESS:$BIND_PORT" -Dtests.clustername="opensearch-integrationtest" -Dhttps=$SECURITY_ENABLED -Duser=$USERNAME -Dpassword=$PASSWORD --console=plain

0 commit comments

Comments
 (0)