From 4a167b0e64faa0d75cfee06c24324a05f54c6370 Mon Sep 17 00:00:00 2001 From: Rishabh Tanwar Date: Fri, 19 Jan 2024 11:38:11 +0000 Subject: [PATCH] Merge replication test with jdbc github action Signed-off-by: Rishabh Tanwar --- .github/workflows/jdbc-tests.yml | 72 ++++++++++++++----- .../workflows/logical-replication-test.yml | 2 +- 2 files changed, 56 insertions(+), 18 deletions(-) diff --git a/.github/workflows/jdbc-tests.yml b/.github/workflows/jdbc-tests.yml index 24a36528905..449e0dffb00 100644 --- a/.github/workflows/jdbc-tests.yml +++ b/.github/workflows/jdbc-tests.yml @@ -47,6 +47,8 @@ jobs: id: install-extensions if: always() && steps.build-postgis-extension.outcome == 'success' uses: ./.github/composite-actions/install-extensions + with: + wal_level: logical - name: Run JDBC Tests id: jdbc @@ -54,51 +56,89 @@ jobs: timeout-minutes: 60 uses: ./.github/composite-actions/run-jdbc-tests + - name: Start secondary server + id: start-secondary + if: always() && steps.jdbc.outcome == 'success' + uses: ./.github/composite-actions/install-extensions + with: + psql_port: 5433 + tsql_port: 8199 + wal_level: logical + + - name: Setup Publication and Subscription + id: setup-pub-sub + if: always() && steps.start-secondary.outcome == 'success' + run: | + ~/${{env.INSTALL_DIR}}/bin/psql -d jdbc_testdb -U runner -c "CREATE PUBLICATION my_pub;" + ~/${{env.INSTALL_DIR}}/bin/psql -d jdbc_testdb -U runner -p 5433 -c "CREATE SUBSCRIPTION my_sub CONNECTION 'host=localhost port=5432 user=jdbc_user dbname=jdbc_testdb password=12345678' PUBLICATION my_pub;" + + - name: Run Replication Tests + id: replication + if: always() && steps.setup-pub-sub.outcome == 'success' + timeout-minutes: 60 + uses: ./.github/composite-actions/run-jdbc-tests + with: + input_dir: 'replication' + - name: Cleanup babelfish database id: cleanup - if: always() && steps.install-extensions.outcome == 'success' + if: always() && steps.replication.outcome == 'success' run: | sudo ~/psql/bin/psql -d postgres -U runner -v user="jdbc_user" -v db="jdbc_testdb" -f .github/scripts/cleanup_babelfish_database.sql - name: Upload Log - if: always() && steps.jdbc.outcome == 'failure' + if: always() && (steps.jdbc.outcome == 'failure' || steps.replication.outcome == 'failure') uses: actions/upload-artifact@v2 with: name: postgres-log-jdbc - path: ~/psql/data/logfile - + path: | + ~/psql/data/logfile + ~/psql/data_5433/logfile + # The test summary files contain paths with ':' characters, which is not allowed with the upload-artifact actions - name: Rename Test Summary Files id: test-file-rename - if: always() && steps.jdbc.outcome == 'failure' + if: always() && (steps.jdbc.outcome == 'failure' || steps.replication.outcome == 'failure') run: | cd test/JDBC/Info timestamp=`ls -Art | tail -n 1` cd $timestamp mv $timestamp.diff ../output-diff.diff mv "$timestamp"_runSummary.log ../run-summary.log - + cd .. + # get the replication output diff as well if it is present + dir_count=`ls | wc -l` + if [[ $dir_count -eq 2 ]];then + timestamp=`ls -rt | tail -n 2 | sort -r | tail -n 1` + cd $timestamp + mv $timestamp.diff ../replication-output-diff.diff + mv "$timestamp"_runSummary.log ../replication-run-summary.log + - name: Upload Run Summary - if: always() && steps.test-file-rename == 'success' + if: always() && steps.test-file-rename.outcome == 'success' uses: actions/upload-artifact@v2 with: name: run-summary.log - path: test/JDBC/Info/run-summary.log - + path: | + test/JDBC/Info/run-summary.log + test/JDBC/Info/replication-run-summary.log + - name: Upload Output Diff - if: always() && steps.jdbc.outcome == 'failure' + if: always() && (steps.jdbc.outcome == 'failure' || steps.replication.outcome == 'failure') uses: actions/upload-artifact@v2 with: name: jdbc-output-diff.diff - path: test/JDBC/Info/output-diff.diff + path: | + test/JDBC/Info/output-diff.diff + test/JDBC/Info/replication-output-diff.diff - name: Check and upload coredumps - if: always() && steps.jdbc.outcome == 'failure' + if: always() && (steps.jdbc.outcome == 'failure' || steps.replication.outcome == 'failure') uses: ./.github/composite-actions/upload-coredump - + - name: Generate Code Coverage id: generate-code-coverage - if: always() && steps.jdbc.outcome == 'success' + if: always() && (steps.jdbc.outcome == 'success' && steps.replication.outcome == 'success') run: | export PG_CONFIG=~/psql/bin/pg_config export PG_SRC=~/work/postgresql_modified_for_babelfish @@ -111,7 +151,7 @@ jobs: cd .. done shell: bash - + - name: Summarize code coverage id: code-coverage-summary if: always() && steps.generate-code-coverage.outcome == 'success' @@ -127,5 +167,3 @@ jobs: name: coverage-babelfish-extensions-jdbc path: contrib/jdbc-lcov.info retention-days: 1 - - diff --git a/.github/workflows/logical-replication-test.yml b/.github/workflows/logical-replication-test.yml index f284ac3e7be..dc748b7f300 100644 --- a/.github/workflows/logical-replication-test.yml +++ b/.github/workflows/logical-replication-test.yml @@ -1,5 +1,5 @@ name: Logical Replication Test -on: [push, pull_request] +on: jobs: run-logical-replication-tests: