From 777a7f78deb74be54fd51d3ca035a66c671d9def Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Fri, 9 Jul 2021 19:36:12 -0400 Subject: [PATCH 1/3] Add integtest script to the repo Signed-off-by: Peter Zhu --- integtest.sh | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100755 integtest.sh diff --git a/integtest.sh b/integtest.sh new file mode 100755 index 00000000..7ab331f7 --- /dev/null +++ b/integtest.sh @@ -0,0 +1,95 @@ +#!/bin/bash + +set -e + +function usage() { + echo "" + echo "This script is used to run integration tests for plugin installed on a remote OpenSearch/Dashboards cluster." + echo "--------------------------------------------------------------------------" + echo "Usage: $0 [args]" + echo "" + echo "Required arguments:" + echo "None" + echo "" + echo "Optional arguments:" + 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." + 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." + echo -e "-s SECURITY_ENABLED\t(true | false), defaults to true. Specify the OpenSearch/Dashboards have security enabled or not." + echo -e "-c CREDENTIAL\t(usename:password), no defaults, effective when SECURITY_ENABLED=true." + echo -e "-d DIRECTORY\tSome Repo has more than 1 directory / component, use this to give that directory for separate tests." + echo -e "-h\tPrint this message." + echo "--------------------------------------------------------------------------" +} + +while getopts ":hb:p:s:c:d:" arg; do + case $arg in + h) + usage + exit 1 + ;; + b) + BIND_ADDRESS=$OPTARG + ;; + p) + BIND_PORT=$OPTARG + ;; + s) + SECURITY_ENABLED=$OPTARG + ;; + c) + CREDENTIAL=$OPTARG + ;; + d) + DIRECTORY=$OPTARG + ;; + :) + echo "-${OPTARG} requires an argument" + usage + exit 1 + ;; + ?) + echo "Invalid option: -${OPTARG}" + exit 1 + ;; + esac +done + + +if [ -z "$BIND_ADDRESS" ] +then + BIND_ADDRESS="localhost" +fi + +if [ -z "$BIND_PORT" ] +then + BIND_PORT="9200" +fi + +if [ -z "$SECURITY_ENABLED" ] +then + SECURITY_ENABLED="true" +fi + +if [ -z "$CREDENTIAL" ] +then + CREDENTIAL="admin:admin" + USERNAME=`echo $CREDENTIAL | awk -F ':' '{print $1}'` + PASSWORD=`echo $CREDENTIAL | awk -F ':' '{print $2}'` +fi + +if [ -z "$DIRECTORY" ] +then + DIRECTORY="root" +fi + + +if [ "$DIRECTORY" = "dashboards-reports" ] +then + cd dashboards-reports + yarn osd bootstrap + npx cypress run +else + cd reports-scheduler + ./gradlew integTest -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 + +fi From 938611f228e1fceee285c98a6390fbb290c79b29 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Fri, 9 Jul 2021 20:13:35 -0400 Subject: [PATCH 2/3] Improve osd bootstrap on dub directory Signed-off-by: Peter Zhu --- integtest.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/integtest.sh b/integtest.sh index 7ab331f7..447c8a4e 100755 --- a/integtest.sh +++ b/integtest.sh @@ -85,6 +85,11 @@ fi if [ "$DIRECTORY" = "dashboards-reports" ] then + cd dashboards-reports + mv -v dashboards-reports ../dashboards-reports-temp + cd ../ + rm -rf dashboards-reports/ + mv -v dashboards-reports-temp dashboards-reports cd dashboards-reports yarn osd bootstrap npx cypress run From 18abf936c40c04ebbec3ba0f3ad52b688bb6a98c Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Fri, 9 Jul 2021 20:22:34 -0400 Subject: [PATCH 3/3] Improve osd bootstrap on dub directory Signed-off-by: Peter Zhu --- integtest.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/integtest.sh b/integtest.sh index 447c8a4e..a12c25e2 100755 --- a/integtest.sh +++ b/integtest.sh @@ -85,7 +85,6 @@ fi if [ "$DIRECTORY" = "dashboards-reports" ] then - cd dashboards-reports mv -v dashboards-reports ../dashboards-reports-temp cd ../ rm -rf dashboards-reports/