From dfe13d688658ad8a343e89ce03308136cc838197 Mon Sep 17 00:00:00 2001 From: Kawika Avilla Date: Tue, 26 Jul 2022 15:19:52 -0700 Subject: [PATCH] [CI] Clean up for BWC tests & run only on PRs for backports (#1948) (#1955) Issue: n/a Backport PRs will also run actions for pushs and PRs which is just unneeded double work everytime. So this prevents that. Also, BWC will run a complete array for every job in the matrix. Now we set the environment variable to prevents the running of the default versions. Finally updating date range of filter tests to be more inclusive for new test data. Signed-off-by: Kawika Avilla (cherry picked from commit 57a751e81eef5395a172e40fab233a20e896bc11) --- .github/workflows/pr_check_workflow.yml | 17 +++++++++++++++-- .../with-security/check_filter_and_query.js | 4 +++- .../without-security/check_filter_and_query.js | 4 +++- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr_check_workflow.yml b/.github/workflows/pr_check_workflow.yml index 294062527d24..cef6aa3c2924 100644 --- a/.github/workflows/pr_check_workflow.yml +++ b/.github/workflows/pr_check_workflow.yml @@ -3,10 +3,10 @@ name: Build and test -# trigger on every commit push and PR for all branches except feature branches +# trigger on every commit push and PR for all branches except feature branches and pushes for backport branches on: push: - branches: [ '**', '!feature/**' ] + branches: [ '**', '!feature/**', '!backport/**' ] pull_request: branches: [ '**', '!feature/**' ] @@ -215,6 +215,10 @@ jobs: - name: Skipping tests if: steps.verify-opensearch-exists.outputs.version-exists != 'true' run: echo Tests were skipped because an OpenSearch release build does not exist for this version yet! + + - name: Setting environment variable to run tests for ${{ matrix.version }} + if: steps.verify-opensearch-exists.outputs.version-exists == 'true' + run: echo "BWC_VERSIONS=${{ matrix.version }}" >> $GITHUB_ENV - name: Download OpenSearch Dashboards uses: actions/download-artifact@v3 @@ -228,3 +232,12 @@ jobs: if: steps.verify-opensearch-exists.outputs.version-exists == 'true' run: | yarn test:bwc -s false -o ${{ env.OPENSEARCH_URL }} -d ${{ steps.download.outputs.download-path }}/opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz -v ${{ matrix.version }} + + - uses: actions/upload-artifact@v3 + if: ${{ failure() && steps.verify-opensearch-exists.outputs.version-exists == 'true' }} + with: + name: ${{ matrix.version }}-test-failures + path: | + ./artifacts/bwc_tmp/test/cypress/videos/without-security/* + ./artifacts/bwc_tmp/test/cypress/screenshots/without-security/* + retention-days: 1 diff --git a/cypress/integration/with-security/check_filter_and_query.js b/cypress/integration/with-security/check_filter_and_query.js index 0055e5c078ed..e1a486dcfce5 100644 --- a/cypress/integration/with-security/check_filter_and_query.js +++ b/cypress/integration/with-security/check_filter_and_query.js @@ -12,6 +12,8 @@ import { const miscUtils = new MiscUtils(cy); const commonUI = new CommonUI(cy); const loginPage = new LoginPage(cy); +const startDate = 'Nov 1, 2016 @ 00:00:00.000'; +const endDate = `Dec 31, ${new Date().getFullYear()} @ 00:00:00.000`; describe('check dashboards filter and query', () => { beforeEach(() => { @@ -66,7 +68,7 @@ describe('check dashboards filter and query', () => { .find('[class="osdSavedQueryListItem__labelText"]') .should('have.text', 'test-query') .click(); - commonUI.setDateRange('Dec 1, 2021 @ 00:00:00.000', 'Jan 1, 2021 @ 00:00:00.000'); + commonUI.setDateRange(endDate, startDate); //[Logs] vistor chart should show osx 100% cy.get('[data-title="[Logs] Visitors by OS"]') diff --git a/cypress/integration/without-security/check_filter_and_query.js b/cypress/integration/without-security/check_filter_and_query.js index 30911d05ba7e..65b9aaf4a98b 100644 --- a/cypress/integration/without-security/check_filter_and_query.js +++ b/cypress/integration/without-security/check_filter_and_query.js @@ -10,6 +10,8 @@ import { const miscUtils = new MiscUtils(cy); const commonUI = new CommonUI(cy); +const startDate = 'Nov 1, 2016 @ 00:00:00.000'; +const endDate = `Dec 31, ${new Date().getFullYear()} @ 00:00:00.000`; describe('check dashboards filter and query', () => { beforeEach(() => { @@ -56,7 +58,7 @@ describe('check dashboards filter and query', () => { .find('[class="osdSavedQueryListItem__labelText"]') .should('have.text', 'test-query') .click(); - commonUI.setDateRange('Dec 1, 2021 @ 00:00:00.000', 'Jan 1, 2021 @ 00:00:00.000'); + commonUI.setDateRange(endDate, startDate); //[Logs] vistor chart should show osx 100% cy.get('[data-title="[Logs] Visitors by OS"]')