From 80a4a32b63e199b5b0a7ce8e85c280e40ad9f319 Mon Sep 17 00:00:00 2001 From: Darshit Chanpura Date: Fri, 15 Dec 2023 17:13:27 -0500 Subject: [PATCH] Addresses changes made to security demo config install tool Signed-off-by: Darshit Chanpura --- .../release-e2e-workflow-template-windows.yml | 10 +- .../release-e2e-workflow-template.yml | 10 +- .github/workflows/release-signoff-chrome.yml | 4 +- .../release-signoff-chromium-ad-only.yml | 4 +- .../release-signoff-chromium-ism-only.yml | 4 +- ...ase-signoff-chromium-tests-in-memory-0.yml | 4 +- ...se-signoff-chromium-tests-in-memory-10.yml | 4 +- ...se-signoff-chromium-tests-in-memory-20.yml | 4 +- ...ase-signoff-chromium-tests-in-memory-5.yml | 4 +- .../workflows/release-signoff-chromium.yml | 4 +- .../workflows/release-signoff-electron.yml | 4 +- .github/workflows/release-signoff-firefox.yml | 4 +- cypress.json | 2 +- integtest.sh | 116 ------------------ 14 files changed, 43 insertions(+), 135 deletions(-) delete mode 100755 integtest.sh diff --git a/.github/workflows/release-e2e-workflow-template-windows.yml b/.github/workflows/release-e2e-workflow-template-windows.yml index 3f8553a84..95d303352 100644 --- a/.github/workflows/release-e2e-workflow-template-windows.yml +++ b/.github/workflows/release-e2e-workflow-template-windows.yml @@ -22,6 +22,8 @@ jobs: TERM: xterm # make Node run in ipv4 first so that cypress can detect 5601 port in CI environment NODE_OPTIONS: '--max-old-space-size=6144 --dns-result-order=ipv4first' + # 2.12 onwards security demo configuration require a custom admin password + OPENSEARCH_INTIAL_ADMIN_PASSWORD: 'myStrongPassword123!' steps: - name: Set up JDK uses: actions/setup-java@v1 @@ -62,8 +64,8 @@ jobs: else echo "Keep OpenSearch Security" nohup ./opensearch-windows-install.bat & - timeout 900 bash -c 'while [[ "$(curl -o /dev/null -w ''%{http_code}'' -u admin:admin -k https://localhost:9200)" != "200" ]]; do echo sleeping 5; sleep 5; done' - curl -sk https://localhost:9200/_cluster/health?pretty -u admin:admin + timeout 900 bash -c 'while [[ "$(curl -o /dev/null -w ''%{http_code}'' -u admin:${{ env.OPENSEARCH_INTIAL_ADMIN_PASSWORD }} -k https://localhost:9200)" != "200" ]]; do echo sleeping 5; sleep 5; done' + curl -sk https://localhost:9200/_cluster/health?pretty -u admin${{ env.OPENSEARCH_INTIAL_ADMIN_PASSWORD }} fi netstat -anP tcp | grep LISTEN | grep 9200 || netstat -ntlp | grep 9200 shell: bash @@ -104,8 +106,8 @@ jobs: else echo "Keep Dashboards Security" bin/opensearch-dashboards.bat & - timeout 300 bash -c 'while [[ "$(curl -k http://localhost:5601/api/status -u admin:admin | jq -r '.status.overall.state')" != "green" ]]; do echo sleeping 5; sleep 5; done' - curl -sk localhost:5601/api/status -u admin:admin | jq + timeout 300 bash -c 'while [[ "$(curl -k http://localhost:5601/api/status -u admin${{ env.OPENSEARCH_INTIAL_ADMIN_PASSWORD }} | jq -r '.status.overall.state')" != "green" ]]; do echo sleeping 5; sleep 5; done' + curl -sk localhost:5601/api/status -u admin${{ env.OPENSEARCH_INTIAL_ADMIN_PASSWORD }} | jq fi netstat -anP tcp | grep LISTEN | grep 5601 || netstat -ntlp | grep 5601 shell: bash diff --git a/.github/workflows/release-e2e-workflow-template.yml b/.github/workflows/release-e2e-workflow-template.yml index 20fe3fa4d..1ece38960 100644 --- a/.github/workflows/release-e2e-workflow-template.yml +++ b/.github/workflows/release-e2e-workflow-template.yml @@ -25,6 +25,8 @@ jobs: TERM: xterm # make Node run in ipv4 first so that cypress can detect 5601 port in CI environment NODE_OPTIONS: '--max-old-space-size=6144 --dns-result-order=ipv4first' + # 2.12 onwards security demo configuration require a custom admin password + OPENSEARCH_INTIAL_ADMIN_PASSWORD: 'myStrongPassword123!' steps: - name: Set up JDK uses: actions/setup-java@v1 @@ -61,8 +63,8 @@ jobs: else echo "Keep OpenSearch Security" ./opensearch-tar-install.sh & - timeout 900 bash -c 'while [[ "$(curl -o /dev/null -w ''%{http_code}'' -u admin:admin -k https://localhost:9200)" != "200" ]]; do sleep 5; done' - curl https://localhost:9200 -u admin:admin --insecure + timeout 900 bash -c 'while [[ "$(curl -o /dev/null -w ''%{http_code}'' -u admin${{ env.OPENSEARCH_INTIAL_ADMIN_PASSWORD }} -k https://localhost:9200)" != "200" ]]; do sleep 5; done' + curl https://localhost:9200 -u admin${{ env.OPENSEARCH_INTIAL_ADMIN_PASSWORD }} --insecure fi - name: Get OpenSearch-Dashboards run: | @@ -92,8 +94,8 @@ jobs: else echo "Keep Dashboards Security" bin/opensearch-dashboards serve ${{ inputs.osd-serve-args }} & - timeout 300 bash -c 'while [[ "$(curl -u admin:admin -k http://localhost:5601/api/status | jq -r '.status.overall.state')" != "green" ]]; do sleep 5; done' - curl http://localhost:5601/api/status -u admin:admin --insecure + timeout 300 bash -c 'while [[ "$(curl -u admin${{ env.OPENSEARCH_INTIAL_ADMIN_PASSWORD }} -k http://localhost:5601/api/status | jq -r '.status.overall.state')" != "green" ]]; do sleep 5; done' + curl http://localhost:5601/api/status -u admin${{ env.OPENSEARCH_INTIAL_ADMIN_PASSWORD }} --insecure fi - name: Get Cypress version id: cypress_version diff --git a/.github/workflows/release-signoff-chrome.yml b/.github/workflows/release-signoff-chrome.yml index 9dc47ddb4..8ee4acacf 100644 --- a/.github/workflows/release-signoff-chrome.yml +++ b/.github/workflows/release-signoff-chrome.yml @@ -13,6 +13,8 @@ jobs: TERM: xterm # make Node run in ipv4 first so that cypress can detect 5601 port in CI environment NODE_OPTIONS: '--max-old-space-size=6144 --dns-result-order=ipv4first' + # 2.12 onwards security demo configuration require a custom admin password + OPENSEARCH_INTIAL_ADMIN_PASSWORD: 'myStrongPassword123!' steps: - name: Checkout functional-test uses: actions/checkout@v2 @@ -29,7 +31,7 @@ jobs: tar -xzf opensearch-${{ env.VERSION }}-linux-x64.tar.gz cd opensearch-${{ env.VERSION }}/ ./opensearch-tar-install.sh & - timeout 900 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' -u admin:admin -k https://localhost:9200)" != "200" ]]; do sleep 5; done' + timeout 900 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' -u admin${{ env.OPENSEARCH_INTIAL_ADMIN_PASSWORD }} -k https://localhost:9200)" != "200" ]]; do sleep 5; done' - name: Get OpenSearch-Dashboards run: | wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/${{ env.VERSION }}/latest/linux/x64/tar/dist/opensearch-dashboards/opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz diff --git a/.github/workflows/release-signoff-chromium-ad-only.yml b/.github/workflows/release-signoff-chromium-ad-only.yml index 96cf1bc8e..ff2a08fdd 100644 --- a/.github/workflows/release-signoff-chromium-ad-only.yml +++ b/.github/workflows/release-signoff-chromium-ad-only.yml @@ -13,6 +13,8 @@ jobs: TERM: xterm # make Node run in ipv4 first so that cypress can detect 5601 port in CI environment NODE_OPTIONS: '--max-old-space-size=6144 --dns-result-order=ipv4first' + # 2.12 onwards security demo configuration require a custom admin password + OPENSEARCH_INTIAL_ADMIN_PASSWORD: 'myStrongPassword123!' steps: - name: Checkout functional-test uses: actions/checkout@v2 @@ -29,7 +31,7 @@ jobs: tar -xzf opensearch-${{ env.VERSION }}-linux-x64.tar.gz cd opensearch-${{ env.VERSION }}/ ./opensearch-tar-install.sh & - timeout 900 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' -u admin:admin -k https://localhost:9200)" != "200" ]]; do sleep 5; done' + timeout 900 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' -u admin${{ env.OPENSEARCH_INTIAL_ADMIN_PASSWORD }} -k https://localhost:9200)" != "200" ]]; do sleep 5; done' - name: Get OpenSearch-Dashboards run: | wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/${{ env.VERSION }}/latest/linux/x64/tar/dist/opensearch-dashboards/opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz diff --git a/.github/workflows/release-signoff-chromium-ism-only.yml b/.github/workflows/release-signoff-chromium-ism-only.yml index 08aa34055..f278693dd 100644 --- a/.github/workflows/release-signoff-chromium-ism-only.yml +++ b/.github/workflows/release-signoff-chromium-ism-only.yml @@ -13,6 +13,8 @@ jobs: TERM: xterm # make Node run in ipv4 first so that cypress can detect 5601 port in CI environment NODE_OPTIONS: '--max-old-space-size=6144 --dns-result-order=ipv4first' + # 2.12 onwards security demo configuration require a custom admin password + OPENSEARCH_INTIAL_ADMIN_PASSWORD: 'myStrongPassword123!' steps: - name: Checkout functional-test uses: actions/checkout@v2 @@ -29,7 +31,7 @@ jobs: tar -xzf opensearch-${{ env.VERSION }}-linux-x64.tar.gz cd opensearch-${{ env.VERSION }}/ ./opensearch-tar-install.sh & - timeout 900 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' -u admin:admin -k https://localhost:9200)" != "200" ]]; do sleep 5; done' + timeout 900 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' -u admin${{ env.OPENSEARCH_INTIAL_ADMIN_PASSWORD }} -k https://localhost:9200)" != "200" ]]; do sleep 5; done' - name: Get OpenSearch-Dashboards run: | wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/${{ env.VERSION }}/latest/linux/x64/tar/dist/opensearch-dashboards/opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz diff --git a/.github/workflows/release-signoff-chromium-tests-in-memory-0.yml b/.github/workflows/release-signoff-chromium-tests-in-memory-0.yml index 8e4604747..50a244e75 100644 --- a/.github/workflows/release-signoff-chromium-tests-in-memory-0.yml +++ b/.github/workflows/release-signoff-chromium-tests-in-memory-0.yml @@ -13,6 +13,8 @@ jobs: TERM: xterm # make Node run in ipv4 first so that cypress can detect 5601 port in CI environment NODE_OPTIONS: '--max-old-space-size=6144 --dns-result-order=ipv4first' + # 2.12 onwards security demo configuration require a custom admin password + OPENSEARCH_INTIAL_ADMIN_PASSWORD: 'myStrongPassword123!' steps: - name: Checkout functional-test uses: actions/checkout@v2 @@ -29,7 +31,7 @@ jobs: tar -xzf opensearch-${{ env.VERSION }}-linux-x64.tar.gz cd opensearch-${{ env.VERSION }}/ ./opensearch-tar-install.sh & - timeout 900 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' -u admin:admin -k https://localhost:9200)" != "200" ]]; do sleep 5; done' + timeout 900 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' -u admin${{ env.OPENSEARCH_INTIAL_ADMIN_PASSWORD }} -k https://localhost:9200)" != "200" ]]; do sleep 5; done' - name: Get OpenSearch-Dashboards run: | wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/${{ env.VERSION }}/latest/linux/x64/tar/dist/opensearch-dashboards/opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz diff --git a/.github/workflows/release-signoff-chromium-tests-in-memory-10.yml b/.github/workflows/release-signoff-chromium-tests-in-memory-10.yml index 599054bb4..9c9ef250a 100644 --- a/.github/workflows/release-signoff-chromium-tests-in-memory-10.yml +++ b/.github/workflows/release-signoff-chromium-tests-in-memory-10.yml @@ -13,6 +13,8 @@ jobs: TERM: xterm # make Node run in ipv4 first so that cypress can detect 5601 port in CI environment NODE_OPTIONS: '--max-old-space-size=6144 --dns-result-order=ipv4first' + # 2.12 onwards security demo configuration require a custom admin password + OPENSEARCH_INTIAL_ADMIN_PASSWORD: 'myStrongPassword123!' steps: - name: Checkout functional-test uses: actions/checkout@v2 @@ -29,7 +31,7 @@ jobs: tar -xzf opensearch-${{ env.VERSION }}-linux-x64.tar.gz cd opensearch-${{ env.VERSION }}/ ./opensearch-tar-install.sh & - timeout 900 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' -u admin:admin -k https://localhost:9200)" != "200" ]]; do sleep 5; done' + timeout 900 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' -u admin${{ env.OPENSEARCH_INTIAL_ADMIN_PASSWORD }} -k https://localhost:9200)" != "200" ]]; do sleep 5; done' - name: Get OpenSearch-Dashboards run: | wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/${{ env.VERSION }}/latest/linux/x64/tar/dist/opensearch-dashboards/opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz diff --git a/.github/workflows/release-signoff-chromium-tests-in-memory-20.yml b/.github/workflows/release-signoff-chromium-tests-in-memory-20.yml index 3a32342cf..53a827a0d 100644 --- a/.github/workflows/release-signoff-chromium-tests-in-memory-20.yml +++ b/.github/workflows/release-signoff-chromium-tests-in-memory-20.yml @@ -13,6 +13,8 @@ jobs: TERM: xterm # make Node run in ipv4 first so that cypress can detect 5601 port in CI environment NODE_OPTIONS: '--max-old-space-size=6144 --dns-result-order=ipv4first' + # 2.12 onwards security demo configuration require a custom admin password + OPENSEARCH_INTIAL_ADMIN_PASSWORD: 'myStrongPassword123!' steps: - name: Checkout functional-test uses: actions/checkout@v2 @@ -29,7 +31,7 @@ jobs: tar -xzf opensearch-${{ env.VERSION }}-linux-x64.tar.gz cd opensearch-${{ env.VERSION }}/ ./opensearch-tar-install.sh & - timeout 900 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' -u admin:admin -k https://localhost:9200)" != "200" ]]; do sleep 5; done' + timeout 900 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' -u admin${{ env.OPENSEARCH_INTIAL_ADMIN_PASSWORD }} -k https://localhost:9200)" != "200" ]]; do sleep 5; done' - name: Get OpenSearch-Dashboards run: | wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/${{ env.VERSION }}/latest/linux/x64/tar/dist/opensearch-dashboards/opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz diff --git a/.github/workflows/release-signoff-chromium-tests-in-memory-5.yml b/.github/workflows/release-signoff-chromium-tests-in-memory-5.yml index 8b2b6faf7..726afea9e 100644 --- a/.github/workflows/release-signoff-chromium-tests-in-memory-5.yml +++ b/.github/workflows/release-signoff-chromium-tests-in-memory-5.yml @@ -13,6 +13,8 @@ jobs: TERM: xterm # make Node run in ipv4 first so that cypress can detect 5601 port in CI environment NODE_OPTIONS: '--max-old-space-size=6144 --dns-result-order=ipv4first' + # 2.12 onwards security demo configuration require a custom admin password + OPENSEARCH_INTIAL_ADMIN_PASSWORD: 'myStrongPassword123!' steps: - name: Checkout functional-test uses: actions/checkout@v2 @@ -29,7 +31,7 @@ jobs: tar -xzf opensearch-${{ env.VERSION }}-linux-x64.tar.gz cd opensearch-${{ env.VERSION }}/ ./opensearch-tar-install.sh & - timeout 900 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' -u admin:admin -k https://localhost:9200)" != "200" ]]; do sleep 5; done' + timeout 900 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' -u admin${{ env.OPENSEARCH_INTIAL_ADMIN_PASSWORD }} -k https://localhost:9200)" != "200" ]]; do sleep 5; done' - name: Get OpenSearch-Dashboards run: | wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/${{ env.VERSION }}/latest/linux/x64/tar/dist/opensearch-dashboards/opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz diff --git a/.github/workflows/release-signoff-chromium.yml b/.github/workflows/release-signoff-chromium.yml index 15015ef74..b8018aa08 100644 --- a/.github/workflows/release-signoff-chromium.yml +++ b/.github/workflows/release-signoff-chromium.yml @@ -13,6 +13,8 @@ jobs: TERM: xterm # make Node run in ipv4 first so that cypress can detect 5601 port in CI environment NODE_OPTIONS: '--max-old-space-size=6144 --dns-result-order=ipv4first' + # 2.12 onwards security demo configuration require a custom admin password + OPENSEARCH_INTIAL_ADMIN_PASSWORD: 'myStrongPassword123!' steps: - name: Checkout functional-test uses: actions/checkout@v2 @@ -29,7 +31,7 @@ jobs: tar -xzf opensearch-${{ env.VERSION }}-linux-x64.tar.gz cd opensearch-${{ env.VERSION }}/ ./opensearch-tar-install.sh & - timeout 900 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' -u admin:admin -k https://localhost:9200)" != "200" ]]; do sleep 5; done' + timeout 900 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' -u admin${{ env.OPENSEARCH_INTIAL_ADMIN_PASSWORD }} -k https://localhost:9200)" != "200" ]]; do sleep 5; done' - name: Get OpenSearch-Dashboards run: | wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/${{ env.VERSION }}/latest/linux/x64/tar/dist/opensearch-dashboards/opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz diff --git a/.github/workflows/release-signoff-electron.yml b/.github/workflows/release-signoff-electron.yml index 140c69b52..5bad2712c 100644 --- a/.github/workflows/release-signoff-electron.yml +++ b/.github/workflows/release-signoff-electron.yml @@ -13,6 +13,8 @@ jobs: TERM: xterm # make Node run in ipv4 first so that cypress can detect 5601 port in CI environment NODE_OPTIONS: '--max-old-space-size=6144 --dns-result-order=ipv4first' + # 2.12 onwards security demo configuration require a custom admin password + OPENSEARCH_INTIAL_ADMIN_PASSWORD: 'myStrongPassword123!' steps: - name: Checkout functional-test uses: actions/checkout@v2 @@ -29,7 +31,7 @@ jobs: tar -xzf opensearch-${{ env.VERSION }}-linux-x64.tar.gz cd opensearch-${{ env.VERSION }}/ ./opensearch-tar-install.sh & - timeout 900 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' -u admin:admin -k https://localhost:9200)" != "200" ]]; do sleep 5; done' + timeout 900 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' -u admin${{ env.OPENSEARCH_INTIAL_ADMIN_PASSWORD }} -k https://localhost:9200)" != "200" ]]; do sleep 5; done' - name: Get OpenSearch-Dashboards run: | wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/${{ env.VERSION }}/latest/linux/x64/tar/dist/opensearch-dashboards/opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz diff --git a/.github/workflows/release-signoff-firefox.yml b/.github/workflows/release-signoff-firefox.yml index 0f99fa5ed..8ffec1acb 100644 --- a/.github/workflows/release-signoff-firefox.yml +++ b/.github/workflows/release-signoff-firefox.yml @@ -13,6 +13,8 @@ jobs: TERM: xterm # make Node run in ipv4 first so that cypress can detect 5601 port in CI environment NODE_OPTIONS: '--max-old-space-size=6144 --dns-result-order=ipv4first' + # 2.12 onwards security demo configuration require a custom admin password + OPENSEARCH_INTIAL_ADMIN_PASSWORD: 'myStrongPassword123!' steps: - name: Checkout functional-test uses: actions/checkout@v2 @@ -29,7 +31,7 @@ jobs: tar -xzf opensearch-${{ env.VERSION }}-linux-x64.tar.gz cd opensearch-${{ env.VERSION }}/ ./opensearch-tar-install.sh & - timeout 900 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' -u admin:admin -k https://localhost:9200)" != "200" ]]; do sleep 5; done' + timeout 900 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' -u admin${{ env.OPENSEARCH_INTIAL_ADMIN_PASSWORD }} -k https://localhost:9200)" != "200" ]]; do sleep 5; done' - name: Get OpenSearch-Dashboards run: | wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/${{ env.VERSION }}/latest/linux/x64/tar/dist/opensearch-dashboards/opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz diff --git a/cypress.json b/cypress.json index f79ebf340..9de868129 100644 --- a/cypress.json +++ b/cypress.json @@ -14,7 +14,7 @@ "SECURITY_ENABLED": false, "AGGREGATION_VIEW": false, "username": "admin", - "password": "admin", + "password": "myStrongPassword123!", "ENDPOINT_WITH_PROXY": false, "MANAGED_SERVICE_ENDPOINT": false, "VISBUILDER_ENABLED": true, diff --git a/integtest.sh b/integtest.sh deleted file mode 100755 index 3adcb0436..000000000 --- a/integtest.sh +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/bash - -set -e - -function usage() { - echo "" - echo "This script is used to run integration tests for plugin installed on a remote OpenSearch/Dashboards cluster." - echo "--------------------------------------------------------------------------" - echo "Usage: $0 [args]" - echo "" - echo "Required arguments:" - echo "None" - echo "" - echo "Optional arguments:" - 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 "-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 "-t TEST_COMPONENTS\t(OpenSearch-Dashboards reportsDashboards etc.), optional, specify test components, separate with space, else test everything." - echo -e "-v VERSION\t, no defaults, indicates the OpenSearch version to test." - echo -e "-o OPTION\t, no defaults, determine the TEST_TYPE value among(default, manifest) in test_finder.sh, optional." - echo -e "-h\tPrint this message." - echo "--------------------------------------------------------------------------" -} - -while getopts ":hb:p:s:c:t:v:o:" arg; do - case $arg in - h) - usage - exit 1 - ;; - b) - BIND_ADDRESS=$OPTARG - ;; - p) - BIND_PORT=$OPTARG - ;; - s) - SECURITY_ENABLED=$OPTARG - ;; - c) - CREDENTIAL=$OPTARG - ;; - t) - TEST_COMPONENTS=$OPTARG - ;; - v) - VERSION=$OPTARG - ;; - o) - OPTION=$OPTARG - ;; - :) - echo "-${OPTARG} requires an argument" - usage - exit 1 - ;; - ?) - echo "Invalid option: -${OPTARG}" - exit 1 - ;; - esac -done - - -if [ -z "$BIND_ADDRESS" ] -then - BIND_ADDRESS="localhost" -fi - -if [ -z "$BIND_PORT" ] -then - BIND_PORT="5601" -fi - -if [ -z "$SECURITY_ENABLED" ] -then - SECURITY_ENABLED="true" -fi - -if [ -z "$CREDENTIAL" ] -then - CREDENTIAL="admin:admin" - USERNAME=`echo $CREDENTIAL | awk -F ':' '{print $1}'` - PASSWORD=`echo $CREDENTIAL | awk -F ':' '{print $2}'` -fi - -# User can send custom browser path through env variable -if [ -z "$BROWSER_PATH" ] -then - BROWSER_PATH="chromium" -fi - -. ./test_finder.sh - -npm install - -TEST_FILES=`get_test_list $TEST_COMPONENTS` -echo -e "Test Files List:" -echo $TEST_FILES | tr ',' '\n' -echo "BROWSER_PATH: $BROWSER_PATH" - -## WARNING: THIS LOGIC NEEDS TO BE THE LAST IN THIS FILE! ## -# Cypress returns back the test failure count in the error code -# The CI outputs the error code as test failure count. -# -# We need to ensure the cypress tests are the last execute process to -# the error code gets passed to the CI. -if [ $SECURITY_ENABLED = "true" ] -then - echo "run security enabled tests" - yarn cypress:run-with-security --browser "$BROWSER_PATH" --spec "$TEST_FILES" -else - echo "run security disabled tests" - yarn cypress:run-without-security --browser "$BROWSER_PATH" --spec "$TEST_FILES" -fi