From 57a751e81eef5395a172e40fab233a20e896bc11 Mon Sep 17 00:00:00 2001 From: Kawika Avilla Date: Tue, 26 Jul 2022 12:58:18 -0700 Subject: [PATCH] [CI] Clean up for BWC tests & run only on PRs for backports (#1948) 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 --- .github/workflows/build_and_test_workflow.yml | 19 ++++++++++++++++--- .../with-security/check_filter_and_query.js | 4 +++- .../check_filter_and_query.js | 4 +++- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_and_test_workflow.yml b/.github/workflows/build_and_test_workflow.yml index ef5c7a4b61d3..d82d0f45bb04 100644 --- a/.github/workflows/build_and_test_workflow.yml +++ b/.github/workflows/build_and_test_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/**' ] @@ -221,6 +221,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 @@ -233,4 +237,13 @@ jobs: - name: Run tests if: steps.verify-opensearch-exists.outputs.version-exists == 'true' run: | - ./bwctest.sh -s false -o ${{ env.OPENSEARCH_URL }} -d ${{ steps.download.outputs.download-path }}/opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz \ No newline at end of file + ./bwctest.sh -s false -o ${{ env.OPENSEARCH_URL }} -d ${{ steps.download.outputs.download-path }}/opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz + + - 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"]')