Skip to content

Commit

Permalink
[BWC] updates to BWC test scripts
Browse files Browse the repository at this point in the history
Allows the calling script with file location or url to enable
the CI/CD pipeline to pass URLs.

Some minor clean ups related to linter and pass by CSV for params.

Finally, update to add releases parameter which enables us to test
version mismatch if/when we allow the out of the box experience of
OpenSearch Dashboards to work with previous versions of OpenSearch.

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
  • Loading branch information
kavilla committed Feb 2, 2022
1 parent 8777eb3 commit 14b80bc
Show file tree
Hide file tree
Showing 48 changed files with 864 additions and 734 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ trash
/built_assets
target
/build
/bwc_tmp
.jruby
.idea
*.iml
Expand Down
6 changes: 3 additions & 3 deletions TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ Say that you would want to debug a test in CI group 1, you can run the following
This will print off an address, to which you could open your chrome browser on your instance and navigate to `chrome://inspect/#devices` and inspect the functional test runner `scripts/functional_tests.js`.

### Backwards Compatibility tests
To run all the backwards compatibility tests on vanilla OpenSearch Dashboards:
To run all the backwards compatibility tests on OpenSearch Dashboards without security:

`yarn test:bwc -o [test path to opensearch.tar.gz] -d [test path to opensearch-dashboards.tar.gz]`

To run all the backwards compatibility tests on bundled dashboards, pass the bundle parameter to the test:
To run all the backwards compatibility tests on OpenSearch Dashboards with security, pass the security parameter to the test:

`yarn test:bwc -o [test path to opensearch.tar.gz] -d [test path to opensearch-dashboards.tar.gz] -b true`
`yarn test:bwc -o [test path to opensearch.tar.gz] -d [test path to opensearch-dashboards.tar.gz] -s true`

To run specific versions' backwards compatibility tests, pass the versions to the test:

Expand Down
74 changes: 23 additions & 51 deletions bwctest.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,31 @@

set -e

# TODO: Update with -latest from distributions
DEFAULT_OPENSEARCH="https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/2.0.0/676/linux/x64/dist/opensearch/opensearch-2.0.0-linux-x64.tar.gz"
# TODO: Update to include all know BWC of data
DEFAULT_VERSIONS="osd-1.1.0"

function usage() {
echo ""
echo "This script is used to run bwc tests on a remote OpenSearch/Dashboards cluster."
echo "--------------------------------------------------------------------------"
echo "Usage: $0 [args]"
echo ""
echo "Required arguments:"
echo "None"
echo -e "-d DASHBOARDS\t, Specify the url of the build/dist of OpenSearch Dashboards"
echo ""
echo "Optional arguments:"
echo -e "-o OPENSEARCH\t, Specify the url of the build/dist of OpenSearch"
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."
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 "-b BUNDLED_OSD\t(true | false), defaults to true. Specify the usage of bundled Dashboards or not."
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 "-h\tPrint this message."
echo "--------------------------------------------------------------------------"
}

while getopts ":ha:p:b:c:" arg; do
while getopts ":h:a:p:s:c:o:d:" arg; do
case $arg in
h)
usage
Expand All @@ -32,12 +38,18 @@ while getopts ":ha:p:b:c:" arg; do
p)
BIND_PORT=$OPTARG
;;
b)
BUNDLED_OSD=$OPTARG
s)
SECURITY_ENABLED=$OPTARG
;;
c)
CREDENTIAL=$OPTARG
;;
o)
OPENSEARCH=$OPTARG
;;
d)
DASHBOARDS=$OPTARG
;;
:)
echo "-${OPTARG} requires an argument"
usage
Expand All @@ -50,50 +62,10 @@ while getopts ":ha:p:b:c:" arg; do
esac
done

[ -z "$BIND_ADDRESS" ] && BIND_ADDRESS="localhost"
[ -z "$BIND_PORT" ] && BIND_PORT="5601"
[ -z "$SECURITY_ENABLED" ] && SECURITY_ENABLED="false"
[ -z "$CREDENTIAL" ] && CREDENTIAL="admin:admin"
[ -z "$OPENSEARCH" ] && OPENSEARCH=$DEFAULT_OPENSEARCH

if [ -z "$BIND_ADDRESS" ]
then
BIND_ADDRESS="localhost"
fi

if [ -z "$BIND_PORT" ]
then
BIND_PORT="5601"
fi

if [ -z "$BUNDLED_OSD" ]
then
BUNDLED_OSD="true"
fi

if [ -z "$CREDENTIAL" ]
then
CREDENTIAL="admin:admin"
USERNAME=`echo $CREDENTIAL | awk -F ':' '{print $1}'`
PASSWORD=`echo $CREDENTIAL | awk -F ':' '{print $2}'`
fi

cwd=$(pwd)
dir="bwc-tmp"
if [ -d "$dir" ]; then
rm -rf "$dir"
echo "bwc-tmp exists and needs to be removed"
fi

mkdir "$dir"
git clone https://github.com/opensearch-project/opensearch-dashboards-functional-test "$dir"
rm -rf "$dir/cypress"
cp -r cypress "$dir"
cd "$dir"

npm install

if [ $BUNDLED_OSD = "true" ]
then
echo "run security enabled tests"
npx cypress run --spec "$cwd/bwc-tmp/cypress/integration/bundled-osd/*.js"
else
npx cypress run --spec "$cwd/bwc-tmp/cypress/integration/osd/*.js"
fi

rm -rf "$cwd/$dir"
./scripts/bwctest_osd.sh -a $BIND_ADDRESS -p $BIND_PORT -s $SECURITY_ENABLED -c $CREDENTIAL -o $OPENSEARCH -d $DASHBOARDS -v $DEFAULT_VERSIONS
90 changes: 0 additions & 90 deletions cypress/integration/osd-bundle/check_loaded_data.js

This file was deleted.

99 changes: 0 additions & 99 deletions cypress/integration/osd-bundle/check_timeline.js

This file was deleted.

Loading

0 comments on commit 14b80bc

Please sign in to comment.