Skip to content

Commit

Permalink
[Tests][BWC][CI] handle distributions with qualifiers (#1469)
Browse files Browse the repository at this point in the history
The original BWC scripts did not expect qualifiers from the CI.
This allows for CI pass distributions with qualifiers for example:
`opensearch-dashboards-2.0.0-rc1`

Issue:
n/a

Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
  • Loading branch information
kavilla authored Apr 16, 2022
1 parent f7a6754 commit 3823007
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
10 changes: 6 additions & 4 deletions bwctest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,18 @@ done
# 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
# Expected to be opensearch-x.y.z-platform-arch.tar.gz or opensearch-x.y.z-qualifier-platform-arch.tar.gz
# Playground is supported path to enable sandbox testing
[[ "$DASHBOARDS" == *"Playground"* ]] && TARBALL="${SLASH_ARR[14]}" || TARBALL="${SLASH_ARR[13]}"
IFS='-' read -ra DASH_ARR <<< "$TARBALL"
# If it contains a qualifer it will be length of 6
[[ ${#DASH_ARR[@]} == 6 ]] && HAS_QUALIFER=true || HAS_QUALIFER=false
# Expected to be arch.tar.gz
DOTS="${DASH_ARR[4]}"
[ $HAS_QUALIFER == true ] && DOTS="${DASH_ARR[5]}" || DOTS="${DASH_ARR[4]}"
IFS='.' read -ra DOTS_ARR <<< "$DOTS"

VERSION="${DASH_ARR[2]}"
PLATFORM="${DASH_ARR[3]}"
[ $HAS_QUALIFER == true ] && VERSION="${DASH_ARR[2]}-${DASH_ARR[3]}" || VERSION="${DASH_ARR[2]}"
[ $HAS_QUALIFER == true ] && PLATFORM="${DASH_ARR[4]}" || PLATFORM="${DASH_ARR[3]}"
ARCH="${DOTS_ARR[0]}"

OPENSEARCH="https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/$VERSION/latest/$PLATFORM/$ARCH/tar/dist/opensearch/opensearch-$VERSION-$PLATFORM-$ARCH.tar.gz"
Expand Down
8 changes: 4 additions & 4 deletions scripts/bwctest_osd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ function run_cypress() {
do
SPEC_FILES+="$TEST_DIR/cypress/integration/$DASHBOARDS_TYPE/*$test.js,"
done
[ ! $IS_CORE ] && echo "Running tests from plugins"
[ $IS_CORE ] && spec="$SPEC_FILES" || "$TEST_DIR/cypress/integration/$DASHBOARDS_TYPE/plugins/*.js"
[ $IS_CORE ] && success_msg="BWC tests for core passed ($spec)" || success_msg="BWC tests for plugin passed ($spec)"
[ $IS_CORE ] && error_msg="BWC tests for core failed ($spec)" || error_msg="BWC tests for plugin failed ($spec)"
[ $IS_CORE == false ] && echo "Running tests from plugins"
[ $IS_CORE == true ] && spec="$SPEC_FILES" || "$TEST_DIR/cypress/integration/$DASHBOARDS_TYPE/plugins/*.js"
[ $IS_CORE == true ] && success_msg="BWC tests for core passed ($spec)" || success_msg="BWC tests for plugin passed ($spec)"
[ $IS_CORE == true ] && error_msg="BWC tests for core failed ($spec)" || error_msg="BWC tests for plugin failed ($spec)"
[ $CI == 1 ] && cypress_args="--browser chromium" || cypress_args=""
env NO_COLOR=1 npx cypress run $cypress_args --headless --spec $spec || test_failures=$?
[ -z $test_failures ] && test_failures=0
Expand Down

0 comments on commit 3823007

Please sign in to comment.