[Backport 3.1] Group by selector on Configuration page always shows "None" after refresh #1209
Workflow file for this run
This file contains hidden or 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
name: Cypress e2e integration tests workflow | |
on: | |
pull_request: | |
branches: | |
- "*" | |
push: | |
branches: | |
- "*" | |
env: | |
OPENSEARCH_DASHBOARDS_VERSION: 'main' | |
OPENSEARCH_VERSION: '3.1.0-SNAPSHOT' | |
QUERY_INSIGHTS_BRANCH: 'main' | |
GRADLE_VERSION: '7.6.1' | |
CYPRESS_VIDEO: true | |
CYPRESS_SCREENSHOT_ON_RUN_FAILURE: true | |
jobs: | |
tests: | |
name: Run Cypress E2E tests | |
timeout-minutes: 90 | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
include: | |
- os: ubuntu-latest | |
cypress_cache_folder: ~/.cache/Cypress | |
runs-on: ${{ matrix.os }} | |
env: | |
# prevents extra Cypress installation progress messages | |
CI: 1 | |
# avoid warnings like "tput: No value for $TERM and no -T specified" | |
TERM: xterm | |
steps: | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 21 | |
distribution: temurin | |
- name: Checkout Query Insights | |
uses: actions/checkout@v4 | |
with: | |
path: query-insights | |
repository: opensearch-project/query-insights | |
ref: ${{ env.QUERY_INSIGHTS_BRANCH }} | |
- name: Set up Gradle | |
uses: gradle/gradle-build-action@v2 | |
with: | |
gradle-version: ${{ env.GRADLE_VERSION }} | |
- name: Run OpenSearch with Query Insights plugin | |
run: | | |
cd query-insights | |
./gradlew run -Dopensearch.version=${{ env.OPENSEARCH_VERSION }} & | |
# Wait for OpenSearch to be ready with health check | |
echo "Waiting for OpenSearch to start..." | |
for i in {1..60}; do | |
if curl -s http://localhost:9200/_cluster/health > /dev/null 2>&1; then | |
echo "OpenSearch is ready!" | |
break | |
fi | |
echo "Attempt $i/60: OpenSearch not ready yet, waiting 10 seconds..." | |
sleep 10 | |
done | |
# Verify OpenSearch is actually running | |
curl -s http://localhost:9200/_cluster/health || (echo "OpenSearch failed to start" && exit 1) | |
# List installed plugins | |
echo -e "\nInstalled Plugins:" | |
curl -s http://localhost:9200/_cat/plugins | sort | |
# Enable WLM mode | |
echo -e "\nEnabling WLM mode:" | |
curl -X PUT "http://localhost:9200/_cluster/settings" \ | |
-H 'Content-Type: application/json' \ | |
-d '{"persistent":{"wlm.workload_group.mode":"enabled"}}' | jq '.' | |
# Test WLM stats endpoint | |
echo -e "\nTesting WLM stats endpoint:" | |
curl -s http://localhost:9200/_wlm/workload_group | jq '.' | |
set -e | |
echo -e "\nTesting if wlm mode is enabled:" | |
MODE=$(curl -s http://localhost:9200/_cluster/settings | jq -r '.persistent.wlm.workload_group.mode') | |
if [ "$MODE" != "enabled" ]; then | |
echo "WLM mode is not enabled (found: $MODE)" | |
exit 1 | |
fi | |
echo "WLM mode is enabled." | |
shell: bash | |
- name: Checkout OpenSearch-Dashboards | |
uses: actions/checkout@v4 | |
with: | |
repository: opensearch-project/OpenSearch-Dashboards | |
path: OpenSearch-Dashboards | |
ref: ${{ env.OPENSEARCH_DASHBOARDS_VERSION }} | |
- name: Checkout Query Insights Dashboards plugin | |
uses: actions/checkout@v4 | |
with: | |
path: OpenSearch-Dashboards/plugins/query-insights-dashboards | |
- 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 | |
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 | |
- name: Bootstrap plugin/OpenSearch-Dashboards | |
run: | | |
cd OpenSearch-Dashboards/plugins/query-insights-dashboards | |
yarn osd bootstrap --single-version=loose | |
- name: Run OpenSearch-Dashboards server | |
run: | | |
cd OpenSearch-Dashboards | |
# Set memory limits and DNS resolution for better performance | |
export NODE_OPTIONS="--max-old-space-size=6144 --dns-result-order=ipv4first" | |
echo "Starting Dashboards..." | |
nohup yarn start --no-base-path --no-watch --server.host="0.0.0.0" > dashboards.log 2>&1 & | |
sleep 10 | |
echo "Initial Dashboards log output:" | |
head -n 100 dashboards.log || true | |
shell: bash | |
- name: Wait for OpenSearch-Dashboards to be ready | |
run: | | |
echo "Waiting for OpenSearch-Dashboards to start..." | |
max_attempts=150 | |
attempt=0 | |
while [ $attempt -lt $max_attempts ]; do | |
if curl -s -f http://localhost:5601/api/status > /dev/null 2>&1; then | |
echo "OpenSearch-Dashboards is ready!" | |
# Output status for debugging | |
echo "=== OpenSearch-Dashboards Status Debug Info ===" | |
curl -s http://localhost:5601/api/status | jq '.' || curl -s http://localhost:5601/api/status | |
echo "==============================================" | |
# Additional wait to ensure plugin is fully loaded | |
sleep 45 | |
break | |
fi | |
attempt=$((attempt + 1)) | |
echo "Attempt $attempt/$max_attempts: OpenSearch-Dashboards not ready yet, waiting 10 seconds..." | |
# Show debug info every 10 attempts | |
if [ $((attempt % 10)) -eq 0 ]; then | |
echo "Debug: Attempting to connect to http://localhost:5601/api/status" | |
curl -s -v http://localhost:5601/api/status || echo "Connection failed" | |
fi | |
sleep 10 | |
done | |
if [ $attempt -eq $max_attempts ]; then | |
echo "OpenSearch-Dashboards failed to start within timeout" | |
echo "Final debug attempt:" | |
curl -s -v http://localhost:5601/api/status || echo "Final connection attempt failed" | |
exit 1 | |
fi | |
# Verify the service is responding | |
curl -s http://localhost:5601/api/status || (echo "OpenSearch-Dashboards health check failed" && exit 1) | |
# Additional verification for plugin loading | |
echo "Waiting additional time for plugin initialization..." | |
sleep 15 | |
shell: bash | |
- name: Verify services are running | |
run: | | |
echo "Checking OpenSearch status..." | |
curl -s http://localhost:9200/_cluster/health | jq '.' || echo "OpenSearch not responding" | |
echo "Checking OpenSearch-Dashboards status..." | |
echo "=== Full OpenSearch-Dashboards Status ===" | |
curl -s http://localhost:5601/api/status || echo "OpenSearch-Dashboards not responding" | |
echo "========================================" | |
echo "Checking OpenSearch-Dashboards overall state..." | |
curl -s http://localhost:5601/api/status | jq '.status.overall.state' || echo "Could not extract overall state" | |
echo "Checking plugin endpoint..." | |
curl -s http://localhost:5601/app/query-insights-dashboards || echo "Plugin endpoint not accessible" | |
shell: bash | |
continue-on-error: true | |
- name: Install Cypress | |
run: | | |
cd OpenSearch-Dashboards/plugins/query-insights-dashboards | |
# This will install Cypress in case the binary is missing which can happen on Windows and Mac | |
# If the binary exists, this will exit quickly so it should not be an expensive operation | |
npx cypress install | |
shell: bash | |
- name: Get Cypress version | |
id: cypress_version | |
run: | | |
cd OpenSearch-Dashboards/plugins/query-insights-dashboards | |
echo "::set-output name=cypress_version::$(cat ./package.json | jq '.dependencies.cypress' | tr -d '"')" | |
- name: Cache Cypress | |
id: cache-cypress | |
uses: actions/cache@v4 | |
with: | |
path: ${{ matrix.cypress_cache_folder }} | |
key: cypress-cache-v2-${{ matrix.os }}-${{ hashFiles('OpenSearch-Dashboards/plugins/query-insights-dashboards/package.json') }} | |
# for now just chrome, use matrix to do all browsers later | |
- name: Cypress tests | |
uses: cypress-io/github-action@v5 | |
with: | |
working-directory: OpenSearch-Dashboards/plugins/query-insights-dashboards | |
command: yarn run cypress run --config defaultCommandTimeout=120000,requestTimeout=120000,responseTimeout=120000,pageLoadTimeout=180000,taskTimeout=120000,execTimeout=120000 | |
wait-on: 'http://localhost:5601' | |
wait-on-timeout: 1200 | |
browser: chrome | |
env: | |
CYPRESS_CACHE_FOLDER: ${{ matrix.cypress_cache_folder }} | |
CI: true | |
timeout-minutes: 60 | |
# Screenshots are only captured on failure, will change this once we do visual regression tests | |
- uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: cypress-screenshots-${{ matrix.os }} | |
path: OpenSearch-Dashboards/plugins/query-insights-dashboards/cypress/screenshots | |
# Test run video was always captured, so this action uses "always()" condition | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: cypress-videos-${{ matrix.os }} | |
path: OpenSearch-Dashboards/plugins/query-insights-dashboards/cypress/videos |