Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate query enhancement tests from functional repo to main #9048

Merged
merged 4 commits into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
/test/fixtures/scenarios
node_modules
target
cypress/fixtures

!/.eslintrc.js

Expand Down
49 changes: 23 additions & 26 deletions .github/workflows/cypress_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ jobs:
- group: 9
config: standard
test_location: ftr
# Query enhanced tests
# Dashboard tests with query enhanced
- group: 10
config: query_enhanced
test_location: ftr
# Dashboard tests
test_location: source
# Dashboard tests with no query enhanced
- group: 11
config: dashboard
test_location: source
Expand All @@ -90,7 +90,7 @@ jobs:
options: --user 1001
env:
START_CMD: ${{ matrix.config == 'query_enhanced' &&
'node ../scripts/opensearch_dashboards --dev --no-base-path --no-watch --savedObjects.maxImportPayloadBytes=10485760 --server.maxPayloadBytes=1759977 --logging.json=false --data.search.aggs.shardDelay.enabled=true --csp.warnLegacyBrowsers=false --uiSettings.overrides["query:enhancements:enabled"]=true --uiSettings.overrides[''home:useNewHomePage'']=true --data_source.enabled=true --opensearch.ignoreVersionMismatch=true' ||
'node scripts/opensearch_dashboards --dev --no-base-path --no-watch --savedObjects.maxImportPayloadBytes=10485760 --server.maxPayloadBytes=1759977 --logging.json=false --data.search.aggs.shardDelay.enabled=true --csp.warnLegacyBrowsers=false --uiSettings.overrides["query:enhancements:enabled"]=true --uiSettings.overrides[''home:useNewHomePage'']=true --data_source.enabled=true --opensearch.ignoreVersionMismatch=true' ||
matrix.config == 'dashboard' &&
'node scripts/opensearch_dashboards --dev --no-base-path --no-watch --savedObjects.maxImportPayloadBytes=10485760 --server.maxPayloadBytes=1759977 --logging.json=false --data.search.aggs.shardDelay.enabled=true' ||
'node ../scripts/opensearch_dashboards --dev --no-base-path --no-watch --savedObjects.maxImportPayloadBytes=10485760 --server.maxPayloadBytes=1759977 --logging.json=false --data.search.aggs.shardDelay.enabled=true --csp.warnLegacyBrowsers=false --uiSettings.overrides["query:enhancements:enabled"]=false' }}
Expand Down Expand Up @@ -172,18 +172,16 @@ jobs:
FORMATTED_SPEC+="cypress/integration/core-opensearch-dashboards/opensearch-dashboards/${i},"
done
echo "SPEC=${FORMATTED_SPEC}" >> $GITHUB_ENV
echo "SPEC=${FORMATTED_SPEC}"

# Setup spec files for Dashboards in-house cypress tests
- name: Setup spec files for Dashboards tests
if: ${{ inputs.specs == '' && matrix.test_location == 'source' }}
shell: bash
run: |
IFS="," read -a SPEC_ARRAY <<< $(yarn --silent osd:ciGroup${{ matrix.group }})
DASHBOARDS_SPEC=''
for i in "${SPEC_ARRAY[@]}"; do
DASHBOARDS_SPEC+="cypress/integration/core_opensearch_dashboards/${i},"
done
DASHBOARDS_SPEC="$(yarn --silent osd:ciGroup${{ matrix.group }})"
echo "DASHBOARDS_SPEC=${DASHBOARDS_SPEC}" >> $GITHUB_ENV
echo "DASHBOARDS_SPEC=${DASHBOARDS_SPEC}"

- name: Get Cypress version
if: ${{ matrix.test_location == 'ftr' }}
Expand All @@ -204,8 +202,8 @@ jobs:
- run: npx cypress cache path

# Run tests based on configuration
- name: Run FT repo tests with no query enhancements
if: matrix.test_location == 'ftr' && matrix.config == 'standard'
- name: Run FT repo tests
if: matrix.test_location == 'ftr'
uses: cypress-io/github-action@v2
with:
working-directory: ${{ env.FTR_PATH }}
Expand All @@ -214,48 +212,47 @@ jobs:
command: yarn cypress:run-without-security --browser ${{ env.CYPRESS_BROWSER }} --spec ${{ env.SPEC }}

- name: Download OpenSearch
if: matrix.test_location == 'ftr' && matrix.config == 'query_enhanced'
if: matrix.config == 'query_enhanced'
uses: suisei-cn/[email protected]
with:
url: https://artifacts.opensearch.org/releases/bundle/opensearch/${{ env.LATEST_VERSION }}/opensearch-${{ env.LATEST_VERSION }}-linux-x64.tar.gz

- name: Extract OpenSearch
if: matrix.test_location == 'ftr' && matrix.config == 'query_enhanced'
if: matrix.config == 'query_enhanced'
run: |
tar -xzf opensearch-*.tar.gz
rm -f opensearch-*.tar.gz
shell: bash

- name: Remove security plugin
if: matrix.test_location == 'ftr' && matrix.config == 'query_enhanced'
if: matrix.config == 'query_enhanced'
run: |
/bin/bash -c "yes | ./opensearch-${{ env.LATEST_VERSION }}/bin/opensearch-plugin remove opensearch-security"
shell: bash

- name: Run OpenSearch
if: matrix.test_location == 'ftr' && matrix.config == 'query_enhanced'
if: matrix.config == 'query_enhanced'
run: |
/bin/bash -c "./opensearch-2.17.0/opensearch-tar-install.sh &"
sleep 30
shell: bash

- name: Run FT repo tests with query enhancements
if: matrix.test_location == 'ftr' && matrix.config == 'query_enhanced'
uses: cypress-io/github-action@v2
with:
working-directory: ${{ env.FTR_PATH }}
start: ${{ env.START_CMD }}
wait-on: 'http://localhost:9200, http://localhost:5601'
command: yarn cypress:run-without-security --browser ${{ env.CYPRESS_BROWSER }} --spec ${{ env.SPEC }}

# Clear Cypress Cache before running Dashboards tests
- name: Clear Cypress Cache
if: matrix.test_location == 'source'
run: npx cypress cache clear

# Run Dashboards Cypress tests within the source repo
- name: Run Dashboards Cypress tests
if: matrix.test_location == 'source'
- name: Run Dashboards Cypress tests with query enhancements
if: matrix.test_location == 'source' && matrix.config == 'query_enhanced'
uses: cypress-io/github-action@v6
with:
install-command: npx cypress install --force
start: ${{ env.START_CMD }}
wait-on: 'http://localhost:9200, http://localhost:5601'
command: yarn cypress:run-without-security --browser ${{ env.CYPRESS_BROWSER }} --spec ${{ env.DASHBOARDS_SPEC }}
- name: Run Dashboards Cypress tests without query enhancements
if: matrix.test_location == 'source' && matrix.config == 'dashboard'
uses: cypress-io/github-action@v6
with:
install-command: npx cypress install --force
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/links_checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ name: Link Checker

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]
branches: [main]

jobs:
linkchecker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Lychee Link Checker
uses: lycheeverse/lychee-action@v1
with:
fail: true
args: --accept=200,403,429 --base . --retry-wait-time=15 --max-retries=5 "**/*.html" "**/*.md" "**/*.txt" "**/*.json" "**/*.js" "**/*.ts" "**/*.tsx"
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- uses: actions/checkout@v4
- name: Lychee Link Checker
uses: lycheeverse/lychee-action@v1
with:
fail: true
args: --accept=200,403,429 --base . --retry-wait-time=15 --max-retries=5 --exclude-path cypress/fixtures "**/*.html" "**/*.md" "**/*.txt" "**/*.json" "**/*.js" "**/*.ts" "**/*.tsx"
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ target
/test/*/screenshots/failure
/test/*/screenshots/session
/test/*/screenshots/visual_regression_gallery.html
cypress/videos/*
cypress/screenshots/*
/html_docs
.eslintcache
/data
Expand Down
2 changes: 2 additions & 0 deletions changelogs/fragments/9048.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- Migrate query enhancement cypress tests to OSD repo ([#9048](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/9048))
10 changes: 9 additions & 1 deletion cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ module.exports = defineConfig({
viewportWidth: 2000,
viewportHeight: 1320,
env: {
ENGINE: {
name: 'default',
url: 'http://localhost:9200',
},
SECONDARY_ENGINE: {
name: 'test_cluster',
url: 'http://localhost:9200',
},
openSearchUrl: 'http://localhost:9200',
SECURITY_ENABLED: false,
AGGREGATION_VIEW: false,
Expand All @@ -27,7 +35,7 @@ module.exports = defineConfig({
},
e2e: {
baseUrl: 'http://localhost:5601',
specPattern: 'cypress/integration/**/*_spec.{js,jsx,ts,tsx}',
specPattern: 'cypress/integration/**/*.spec.{js,jsx,ts,tsx}',
testIsolation: false,
setupNodeEvents,
},
Expand Down
Loading
Loading