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 <[email protected]>
  • Loading branch information
kavilla committed Feb 28, 2022
1 parent 8ba11e3 commit 45f6d91
Show file tree
Hide file tree
Showing 49 changed files with 865 additions and 733 deletions.
7 changes: 7 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -743,5 +743,12 @@ module.exports = {
],
},
},
{
files: ['cypress/**/*.js'],
rules: {
'import/no-unresolved': 'off',
'no-undef': 'off',
},
},
],
};
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
87 changes: 37 additions & 50 deletions bwctest.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,52 @@

set -e

# TODO: Update to include all known 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 "-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 "-o OPENSEARCH\t, Specify the url of the build/dist of OpenSearch"
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 "-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:b:p:s:c:o:d:" arg; do
case $arg in
h)
usage
exit 1
;;
a)
b)
BIND_ADDRESS=$OPTARG
;;
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 +60,27 @@ 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"

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 no OpenSearch build was passed then this constructs the version
if [ -z "$OPENSEARCH" ]; then
IFS='/' read -ra SLASH_ARR <<< "$DASHBOARDS"
# Expected to be opensearch-x.y.z-platform-arch.tar.gz
TARBALL="${SLASH_ARR[12]}"
IFS='-' read -ra DASH_ARR <<< "$TARBALL"
# Expected to be arch.tar.gz
DOTS="${DASH_ARR[4]}"
IFS='.' read -ra DOTS_ARR <<< "$DOTS"

VERSION="${DASH_ARR[2]}"
PLATFORM="${DASH_ARR[3]}"
ARCH="${DOTS_ARR[0]}"

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"
# TODO: Replace '676' with -latest from distributions
OPENSEARCH="https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/$VERSION/676/$PLATFORM/$ARCH/dist/opensearch/opensearch-$VERSION-$PLATFORM-$ARCH.tar.gz"
fi

rm -rf "$cwd/$dir"
./scripts/bwctest_osd.sh -b $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 45f6d91

Please sign in to comment.