-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Kaituo Li <[email protected]>
- Loading branch information
Showing
7 changed files
with
236 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,133 +1,175 @@ | ||
# Running AD integ tests stored in https://github.com/opensearch-project/opensearch-dashboards-functional-test | ||
# In the future we should pull dependencies from bundled build snapshots. Because that is not available | ||
# yet we build the cluster from source (besides core Opensearch, which is a pulled min artifact). | ||
name: Remote integ tests workflow | ||
on: | ||
push: | ||
branches: | ||
- "*" | ||
pull_request: | ||
branches: | ||
- "*" | ||
name: FTR E2E AD Workbench Test | ||
|
||
on: [pull_request, push] | ||
|
||
env: | ||
CI: 1 | ||
# avoid warnings like "tput: No value for $TERM and no -T specified" | ||
TERM: xterm | ||
OPENSEARCH_DASHBOARDS_VERSION: '2.x' | ||
|
||
jobs: | ||
test-without-security: | ||
name: Run integ tests without security | ||
tests: | ||
name: Run FTR E2E AD Workbench Tests | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest, windows-latest] | ||
java: [11] | ||
include: | ||
- os: windows-latest | ||
cypress_cache_folder: ~/AppData/Local/Cypress/Cache | ||
- os: ubuntu-latest | ||
cypress_cache_folder: ~/.cache/Cypress | ||
os: [ ubuntu-latest ] | ||
jdk: [ 11 ] | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Set up Java 11 | ||
uses: actions/setup-java@v3 | ||
- name: Set up JDK | ||
uses: actions/setup-java@v1 | ||
with: | ||
distribution: 'corretto' | ||
java-version: '11' | ||
java-version: ${{ matrix.jdk }} | ||
|
||
- name: Enable longer filenames | ||
if: ${{ matrix.os == 'windows-latest' }} | ||
run: git config --system core.longpaths true | ||
- name: Checkout Anomaly-Detection | ||
uses: actions/checkout@v2 | ||
with: | ||
path: anomaly-detection | ||
repository: opensearch-project/anomaly-detection | ||
ref: ${{ env.OPENSEARCH_DASHBOARDS_VERSION }} | ||
|
||
- name: Run OpenSearch with plugin | ||
run: | | ||
cd anomaly-detection | ||
./gradlew run & | ||
timeout 300 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9200)" != "200" ]]; do sleep 5; done' | ||
shell: bash | ||
|
||
- name: Check OpenSearch Running on Linux | ||
if: ${{ runner.os != 'Windows'}} | ||
run: curl http://localhost:9200/ | ||
shell: bash | ||
|
||
- name: Checkout OpenSearch Dashboards | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: opensearch-project/OpenSearch-Dashboards | ||
ref: '${{ github.base_ref }}' | ||
path: OpenSearch-Dashboards | ||
repository: opensearch-project/OpenSearch-Dashboards | ||
ref: ${{ env.OPENSEARCH_DASHBOARDS_VERSION }} | ||
fetch-depth: 0 | ||
filter: | | ||
cypress | ||
test | ||
- name: Checkout Anomaly Detection OpenSearch Dashboards plugin | ||
- name: Checkout AD in OpenSearch Dashboards Plugins Dir | ||
uses: actions/checkout@v2 | ||
with: | ||
path: OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin | ||
path: OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version-file: './OpenSearch-Dashboards/.nvmrc' | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Install Yarn | ||
# Need to use bash to avoid having a windows/linux specific step | ||
shell: bash | ||
- id: tool-versions | ||
run: | | ||
YARN_VERSION=$(node -p "require('./OpenSearch-Dashboards/package.json').engines.yarn") | ||
echo "Installing yarn@$YARN_VERSION" | ||
npm i -g yarn@$YARN_VERSION | ||
- run: node -v | ||
- run: yarn -v | ||
echo "node_version=$(cat .node-version)" >> $GITHUB_OUTPUT | ||
echo "yarn_version=$(jq -r '.engines.yarn' package.json)" >> $GITHUB_OUTPUT | ||
working-directory: OpenSearch-Dashboards | ||
shell: bash | ||
|
||
- name: Checkout Anomaly-Detection | ||
uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
path: anomaly-detection | ||
repository: opensearch-project/anomaly-detection | ||
ref: '${{ github.base_ref }}' | ||
node-version: ${{ steps.tool-versions.outputs.node_version }} | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Run OpenSearch with plugin | ||
- name: Setup Opensearch Dashboards | ||
run: | | ||
cd anomaly-detection | ||
CONFIG_PATH=../OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin/opensearch_dashboards.json | ||
OPENSEARCH_VERSION=$(node -p "require('$CONFIG_PATH').opensearchDashboardsVersion")-SNAPSHOT | ||
echo "Using OpenSearch version $OPENSEARCH_VERSION" | ||
./gradlew run -Dopensearch.version=$OPENSEARCH_VERSION & | ||
timeout 300 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9200)" != "200" ]]; do sleep 5; done' | ||
npm uninstall -g yarn | ||
echo "Installing yarn ${{ steps.tool-versions.outputs.yarn_version }}" | ||
npm i -g yarn@${{ steps.tool-versions.outputs.yarn_version }} | ||
yarn cache clean | ||
yarn add sha.js | ||
working-directory: OpenSearch-Dashboards | ||
shell: bash | ||
|
||
- name: Bootstrap the plugin | ||
- name: Boodstrap Opensearch Dashboards | ||
run: | | ||
cd OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin | ||
yarn osd bootstrap --single-version=loose | ||
working-directory: OpenSearch-Dashboards/plugins/anomaly-detection-dashboards-plugin | ||
|
||
- name: Run OpenSearch Dashboards server | ||
- name: Run Opensearch Dashboards with AD Installed | ||
run: | | ||
cd OpenSearch-Dashboards | ||
yarn start --no-base-path --no-watch & | ||
shell: bash | ||
nohup yarn start --no-base-path --no-watch --server.host="0.0.0.0" | tee dashboard.log & | ||
working-directory: OpenSearch-Dashboards | ||
|
||
# Window is slow so wait longer | ||
- name: Sleep until OSD server starts - windows | ||
if: ${{ matrix.os == 'windows-latest' }} | ||
run: Start-Sleep -s 400 | ||
shell: powershell | ||
- name : Check If OpenSearch Dashboards Is Ready | ||
if: ${{ runner.os == 'Linux' }} | ||
run: | | ||
if timeout 600 grep -q "bundles compiled successfully after" <(tail -n0 -f dashboard.log); then | ||
echo "OpenSearch Dashboards compiled successfully." | ||
else | ||
echo "Timeout for 600 seconds reached. OpenSearch Dashboards did not finish compiling." | ||
exit 1 | ||
fi | ||
working-directory: OpenSearch-Dashboards | ||
|
||
- name: Show OpenSearch Dashboards Logs | ||
if: always() | ||
run: cat dashboard.log | ||
working-directory: OpenSearch-Dashboards | ||
|
||
- name: Health check | ||
run: | | ||
timeout 600 bash -c 'while [[ "$(curl -k http://localhost:5601/api/status | jq -r '.status.overall.state')" != "green" ]]; do sleep 5; done' | ||
shell: bash | ||
|
||
- name: Sleep until OSD server starts - non-windows | ||
if: ${{ matrix.os != 'windows-latest' }} | ||
run: sleep 300 | ||
- name: Check OpenSearch Dashboards Running on Linux | ||
if: ${{ runner.os != 'Windows'}} | ||
run: curl http://localhost:5601/api/status | ||
shell: bash | ||
|
||
- name: Checkout opensearch-dashboards-functional-test | ||
- name: Checkout Dashboards Functional Test Repo | ||
uses: actions/checkout@v2 | ||
with: | ||
path: opensearch-dashboards-functional-test | ||
repository: opensearch-project/opensearch-dashboards-functional-test | ||
ref: '${{ github.base_ref }}' | ||
ref: ${{ env.OPENSEARCH_DASHBOARDS_VERSION }} | ||
fetch-depth: 0 | ||
|
||
- name: Install Cypress | ||
run: | | ||
npm install cypress --save-dev | ||
shell: bash | ||
working-directory: opensearch-dashboards-functional-test | ||
|
||
- name: Get Cypress version | ||
id: cypress_version | ||
run: | | ||
echo "::set-output name=cypress_version::$(cat ./opensearch-dashboards-functional-test/package.json | jq '.devDependencies.cypress' | tr -d '"')" | ||
echo "::set-output name=cypress_version::$(cat ./package.json | jq '.dependencies.cypress' | tr -d '"')" | ||
working-directory: opensearch-dashboards-functional-test | ||
|
||
- name: Cache Cypress | ||
id: cache-cypress | ||
uses: actions/cache@v1 | ||
- name: Finding spec files and store to output | ||
id: finding-files | ||
run: | | ||
echo "::set-output name=FILELIST::$(find cypress/integration/plugins/anomaly-detection-dashboards-plugin -name '*.js' -print)" | ||
working-directory: opensearch-dashboards-functional-test | ||
|
||
- name: Print spec files from output | ||
run: | | ||
IFS="," read -a myarray <<< ${{ steps.finding-files.outputs.FILELIST }} | ||
for i in "${myarray[@]}"; do | ||
echo "${i}" | ||
done | ||
working-directory: opensearch-dashboards-functional-test | ||
|
||
- name: Run spec files from output | ||
run: | | ||
IFS="," read -a myarray <<< ${{ steps.finding-files.outputs.FILELIST }} | ||
for i in "${myarray[@]}"; do | ||
yarn cypress:run-without-security --browser electron --spec "${i}" | ||
sleep 60 | ||
done | ||
working-directory: opensearch-dashboards-functional-test | ||
|
||
- name: Capture failure screenshots | ||
uses: actions/upload-artifact@v1 | ||
if: failure() | ||
with: | ||
path: ${{ matrix.cypress_cache_folder }} | ||
key: cypress-cache-v2-${{ runner.os }}-${{ hashFiles('**/package.json') }} | ||
env: | ||
CYPRESS_INSTALL_BINARY: ${{ steps.cypress_version.outputs.cypress_version }} | ||
- run: npx cypress cache list | ||
- run: npx cypress cache path | ||
|
||
- name: Run AD cypress tests | ||
uses: cypress-io/github-action@v2 | ||
name: cypress-screenshots-${{ matrix.os }} | ||
path: opensearch-dashboards-functional-test/cypress/screenshots | ||
|
||
- name: Capture failure test video | ||
uses: actions/upload-artifact@v1 | ||
if: failure() | ||
with: | ||
working-directory: opensearch-dashboards-functional-test | ||
command: yarn run cypress run --env SECURITY_ENABLED=false --spec cypress/integration/plugins/anomaly-detection-dashboards-plugin/**/*.js | ||
env: | ||
CYPRESS_CACHE_FOLDER: ${{ matrix.cypress_cache_folder }} | ||
name: cypress-videos-${{ matrix.os }} | ||
path: opensearch-dashboards-functional-test/cypress/videos |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.