From 91926a0530f72013c44e387ddc9a2b5f1baa150a Mon Sep 17 00:00:00 2001 From: Divya Madala <113469545+Divyaasm@users.noreply.github.com> Date: Thu, 27 Apr 2023 13:31:43 -0700 Subject: [PATCH] add optional parameter -o to integtest.sh (#644) Signed-off-by: Divya Madala (cherry picked from commit f26523133ce33618b78f1557a07edd00a12c2ac5) --- integtest.sh | 10 +++++++--- test_finder.sh | 6 +++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/integtest.sh b/integtest.sh index da15b02e9..b1bc8811c 100755 --- a/integtest.sh +++ b/integtest.sh @@ -2,8 +2,6 @@ set -e -. ./test_finder.sh - function usage() { echo "" echo "This script is used to run integration tests for plugin installed on a remote OpenSearch/Dashboards cluster." @@ -20,11 +18,12 @@ function usage() { echo -e "-c CREDENTIAL\t(usename:password), no defaults, effective when SECURITY_ENABLED=true." echo -e "-t TEST_COMPONENTS\t(OpenSearch-Dashboards reportsDashboards etc.), optional, specify test components, separate with space, else test everything." echo -e "-v VERSION\t, no defaults, indicates the OpenSearch version to test." + echo -e "-o OPTION\t, no defaults, determine the TEST_TYPE value among(default, manifest) in test_finder.sh, optional." echo -e "-h\tPrint this message." echo "--------------------------------------------------------------------------" } -while getopts ":hb:p:s:c:t:v:" arg; do +while getopts ":hb:p:s:c:t:v:o:" arg; do case $arg in h) usage @@ -48,6 +47,9 @@ while getopts ":hb:p:s:c:t:v:" arg; do v) VERSION=$OPTARG ;; + o) + OPTION=$OPTARG + ;; :) echo "-${OPTARG} requires an argument" usage @@ -83,6 +85,8 @@ then PASSWORD=`echo $CREDENTIAL | awk -F ':' '{print $2}'` fi +. ./test_finder.sh + npm install TEST_FILES=`get_test_list $TEST_COMPONENTS` diff --git a/test_finder.sh b/test_finder.sh index 37cd94d02..602dc1c1b 100755 --- a/test_finder.sh +++ b/test_finder.sh @@ -5,6 +5,7 @@ set -e OSD_BUILD_MANIFEST='../local-test-cluster/opensearch-dashboards-*/manifest.yml' OSD_TEST_PATH='cypress/integration/core-opensearch-dashboards' OSD_PLUGIN_TEST_PATH='cypress/integration/plugins' +TEST_TYPE=$OPTION # Map component name in opensearch-build repo INPUT_MANIFEST with folder name for tests in functional repo OSD_COMPONENT_TEST_MAP=( "OpenSearch-Dashboards:opensearch-dashboards" @@ -24,7 +25,10 @@ OSD_COMPONENT_TEST_MAP=( "OpenSearch-Dashboards:opensearch-dashboards" "securityAnalyticsDashboards:security-analytics-dashboards-plugin" ) -[ -f $OSD_BUILD_MANIFEST ] && TEST_TYPE="manifest" || TEST_TYPE="default" +if [ -z $TEST_TYPE ]; then + [ -f $OSD_BUILD_MANIFEST ] && TEST_TYPE="manifest" || TEST_TYPE="default" +fi + [ ! `echo $SHELL | grep 'bash'` ] && echo "You must run this script with bash as other shells like zsh will fail the script, exit in 10" && sleep 10 && exit 1 # Checks if build manifest in parent directory of current directory under local-test-cluster/opensearch-dashboards-*