From 1cd0d66c9f8530178b3c8afdff5ad0fb9bb1db36 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Fri, 26 Jan 2024 13:17:26 -0500 Subject: [PATCH 01/96] reuse shared actions from `dbt-adapters` --- .github/actions/publish-pypi/action.yml | 25 -------------------- .github/actions/setup-environment/action.yml | 18 -------------- .github/workflows/release.yml | 9 ++++--- 3 files changed, 6 insertions(+), 46 deletions(-) delete mode 100644 .github/actions/publish-pypi/action.yml delete mode 100644 .github/actions/setup-environment/action.yml diff --git a/.github/actions/publish-pypi/action.yml b/.github/actions/publish-pypi/action.yml deleted file mode 100644 index 01cbc1cb..00000000 --- a/.github/actions/publish-pypi/action.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Publish PyPI - -inputs: - python-version: - description: Create an environment with the appropriate version of python and hatch installed - default: "3.11" - -runs: - using: composite - steps: - - name: Setup environment - uses: ./.github/actions/setup-environment - with: - python-version: ${{ inputs.python-version }} - - - name: Build artifacts - run: hatch build - shell: bash - - - name: Check artifacts - run: hatch run build:check-all - shell: bash - - - name: Publish artifacts to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/.github/actions/setup-environment/action.yml b/.github/actions/setup-environment/action.yml deleted file mode 100644 index 6227c698..00000000 --- a/.github/actions/setup-environment/action.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Setup `hatch` - -inputs: - python-version: - description: Create an environment with the appropriate version of python and hatch installed - required: true - -runs: - using: composite - steps: - - name: Set up Python ${{ inputs.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ inputs.python-version }} - - - name: Install hatch - run: python -m pip install hatch - shell: bash diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9b92ee91..e4d31bf6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,7 +29,7 @@ jobs: runs-on: ubuntu-latest environment: name: ${{ inputs.deploy-to }} - url: ${{ vars.PYPI_URL }} + url: ${{ vars.PYPI_PROJECT_URL }} permissions: id-token: write # IMPORTANT: this permission is mandatory for trusted publishing @@ -39,7 +39,10 @@ jobs: with: persist-credentials: false + - name: Setup environment + uses: dbt-labs/dbt-adapters/.github/actions/setup-environment + - name: Publish to PyPI - uses: ./.github/actions/publish-pypi + uses: dbt-labs/dbt-adapters/.github/actions/publish-pypi.yml@main with: - python-version: "3.11" + deploy-to: ${{ inputs.deploy-to }} From a45563eb648de9aec05f932c734822b423c0fe67 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Fri, 26 Jan 2024 17:15:19 -0500 Subject: [PATCH 02/96] make updates that reflect updates in the shared actions for publishing --- .github/workflows/release.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e4d31bf6..75166ab2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,7 +19,7 @@ defaults: # will cancel previous workflows triggered by the same event and for the same ref for PRs or same SHA otherwise concurrency: - group: ${{ github.workflow }}-${{ github.event_name }}-${{ contains(github.event_name, 'pull_request') && github.event.pull_request.head.ref || github.sha }} + group: ${{ github.workflow }}-${{ github.event_name }}-${{ contains(github.event_name, 'pull_request') && github.event.pull_request.head.ref || github.sha }}-${{ inputs.deploy-to }} cancel-in-progress: true jobs: @@ -39,10 +39,13 @@ jobs: with: persist-credentials: false - - name: Setup environment - uses: dbt-labs/dbt-adapters/.github/actions/setup-environment + - name: Setup `hatch` + uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch.yml@main + + - name: Build `dbt-postgres` + uses: dbt-labs/dbt-adapters/.github/actions/build-hatch.yml@main - name: Publish to PyPI uses: dbt-labs/dbt-adapters/.github/actions/publish-pypi.yml@main with: - deploy-to: ${{ inputs.deploy-to }} + pypi-repository-url: ${{ vars.PYPI_REPOSITORY_URL }} From 087579ec52933c090af438dfd216a48e9c564c65 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Fri, 26 Jan 2024 17:25:06 -0500 Subject: [PATCH 03/96] point workflows to shared actions in dbt-adapters --- .github/actions/publish-results/action.yml | 25 -------------- .github/workflows/code-quality.yml | 20 +++++++++++ .github/workflows/integration-tests.yml | 6 ++-- .github/workflows/lint.yml | 40 ---------------------- .github/workflows/release.yml | 5 --- .github/workflows/unit-tests.yml | 31 +---------------- 6 files changed, 24 insertions(+), 103 deletions(-) delete mode 100644 .github/actions/publish-results/action.yml create mode 100644 .github/workflows/code-quality.yml delete mode 100644 .github/workflows/lint.yml diff --git a/.github/actions/publish-results/action.yml b/.github/actions/publish-results/action.yml deleted file mode 100644 index 5bd6e341..00000000 --- a/.github/actions/publish-results/action.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Publish results - -inputs: - file-name: - description: File type for file name stub (e.g. "unit-tests") - required: true - python-version: - description: Create an environment with the appropriate version of python and hatch installed - required: true - source-file: - description: File to be uploaded - required: true - -runs: - using: composite - steps: - - name: Get timestamp - id: timestamp - run: echo "ts=$(date +'%Y-%m-%dT%H_%M_%S')" >> $GITHUB_OUTPUT #no colons allowed for artifacts - shell: bash - - - uses: actions/upload-artifact@v3 - with: - name: ${{ inputs.file-name }}_${{ inputs.python-version }}-${{ steps.timestamp.outputs.ts }}.csv - path: ${{ inputs.source-file }} diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml new file mode 100644 index 00000000..e4b8e53c --- /dev/null +++ b/.github/workflows/code-quality.yml @@ -0,0 +1,20 @@ +name: Code Quality + +on: + push: + branches: + - "main" + - "*.latest" + pull_request: + workflow_dispatch: + +permissions: read-all + +# will cancel previous workflows triggered by the same event and for the same ref for PRs or same SHA otherwise +concurrency: + group: ${{ github.workflow }}-${{ github.event_name }}-${{ contains(github.event_name, 'pull_request') && github.event.pull_request.head.ref || github.sha }} + cancel-in-progress: true + +jobs: + code-quality: + uses: dbt-labs/dbt-adapters/.github/workflows/code-quality.yml@main diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index ec1f6e5f..03096747 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -31,8 +31,8 @@ jobs: with: persist-credentials: false - - name: Setup environment - uses: ./.github/actions/setup-environment + - name: Setup `hatch` + uses: ./.github/actions/setup-hatch with: python-version: ${{ matrix.python-version }} @@ -53,7 +53,7 @@ jobs: shell: bash - name: Publish results - uses: ./.github/actions/publish-results + uses: dbt-labs/dbt-adapters/.github/actions/publish-results.yml@main if: always() with: source-file: "results.csv" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 2b336a43..00000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Lint - -on: - push: - branches: - - "main" - - "*.latest" - pull_request: - workflow_dispatch: - -permissions: read-all - -# will cancel previous workflows triggered by the same event and for the same ref for PRs or same SHA otherwise -concurrency: - group: ${{ github.workflow }}-${{ github.event_name }}-${{ contains(github.event_name, 'pull_request') && github.event.pull_request.head.ref || github.sha }} - cancel-in-progress: true - -jobs: - lint: - name: Python 3.8 - runs-on: ubuntu-latest - - steps: - - name: Check out repository - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Setup environment - uses: ./.github/actions/setup-environment - with: - python-version: "3.8" - - - name: Run linters - run: hatch run lint:all - shell: bash - - - name: Run typechecks - run: hatch run typecheck:all - shell: bash diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 75166ab2..8c2f076b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,17 +13,12 @@ on: permissions: read-all -defaults: - run: - shell: bash - # will cancel previous workflows triggered by the same event and for the same ref for PRs or same SHA otherwise concurrency: group: ${{ github.workflow }}-${{ github.event_name }}-${{ contains(github.event_name, 'pull_request') && github.event.pull_request.head.ref || github.sha }}-${{ inputs.deploy-to }} cancel-in-progress: true jobs: - release: name: PyPI - ${{ inputs.deploy-to }} runs-on: ubuntu-latest diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index f8a39ea8..a01f3e02 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -17,33 +17,4 @@ concurrency: jobs: unit: - name: Python ${{ matrix.python-version }} - runs-on: ubuntu-latest - - strategy: - fail-fast: false - matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] - - steps: - - name: Check out repository - uses: actions/checkout@v4 - with: - persist-credentials: false - - - name: Setup environment - uses: ./.github/actions/setup-environment - with: - python-version: ${{ matrix.python-version }} - - - name: Run unit tests - run: hatch run unit-tests:all - shell: bash - - - name: Publish results - uses: ./.github/actions/publish-results - if: always() - with: - source-file: "results.csv" - file-name: "unit_results" - python-version: ${{ matrix.python-version }} + uses: dbt-labs/dbt-adapters/.github/workflows/unit-tests.yml@main From c49c76b2b049c0158d6160caff9a2d90b35a53b8 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Fri, 26 Jan 2024 17:26:41 -0500 Subject: [PATCH 04/96] point workflows to config/release branch to test --- .github/workflows/code-quality.yml | 2 +- .github/workflows/integration-tests.yml | 2 +- .github/workflows/unit-tests.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index e4b8e53c..06fc5828 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -17,4 +17,4 @@ concurrency: jobs: code-quality: - uses: dbt-labs/dbt-adapters/.github/workflows/code-quality.yml@main + uses: dbt-labs/dbt-adapters/.github/workflows/code-quality.yml@config/release diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 03096747..4301719d 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -53,7 +53,7 @@ jobs: shell: bash - name: Publish results - uses: dbt-labs/dbt-adapters/.github/actions/publish-results.yml@main + uses: dbt-labs/dbt-adapters/.github/actions/publish-results.yml@config/release if: always() with: source-file: "results.csv" diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index a01f3e02..4e564c8c 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -17,4 +17,4 @@ concurrency: jobs: unit: - uses: dbt-labs/dbt-adapters/.github/workflows/unit-tests.yml@main + uses: dbt-labs/dbt-adapters/.github/workflows/unit-tests.yml@config/release From 87125f92d4634bd369705a683d663fa846dff973 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Fri, 26 Jan 2024 17:34:31 -0500 Subject: [PATCH 05/96] point actions to config/release branch to test --- .github/workflows/code-quality.yml | 18 +++++++++++++- .github/workflows/integration-tests.yml | 4 ++-- .github/workflows/release.yml | 6 ++--- .github/workflows/unit-tests.yml | 31 ++++++++++++++++++++++++- 4 files changed, 52 insertions(+), 7 deletions(-) diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 06fc5828..e3a9849e 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -17,4 +17,20 @@ concurrency: jobs: code-quality: - uses: dbt-labs/dbt-adapters/.github/workflows/code-quality.yml@config/release + name: Python 3.8 + runs-on: ubuntu-latest + + steps: + - name: Check out repository + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Setup `hatch` + uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@config/release + + - name: Run linters + run: hatch run lint:all + + - name: Run typechecks + run: hatch run typecheck:all diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 4301719d..bc471d08 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -32,7 +32,7 @@ jobs: persist-credentials: false - name: Setup `hatch` - uses: ./.github/actions/setup-hatch + uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@config/release with: python-version: ${{ matrix.python-version }} @@ -53,7 +53,7 @@ jobs: shell: bash - name: Publish results - uses: dbt-labs/dbt-adapters/.github/actions/publish-results.yml@config/release + uses: dbt-labs/dbt-adapters/.github/actions/publish-results@config/release if: always() with: source-file: "results.csv" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8c2f076b..ccf805f5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -35,12 +35,12 @@ jobs: persist-credentials: false - name: Setup `hatch` - uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch.yml@main + uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@main - name: Build `dbt-postgres` - uses: dbt-labs/dbt-adapters/.github/actions/build-hatch.yml@main + uses: dbt-labs/dbt-adapters/.github/actions/build-hatch@main - name: Publish to PyPI - uses: dbt-labs/dbt-adapters/.github/actions/publish-pypi.yml@main + uses: dbt-labs/dbt-adapters/.github/actions/publish-pypi@main with: pypi-repository-url: ${{ vars.PYPI_REPOSITORY_URL }} diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 4e564c8c..f377cfe7 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -17,4 +17,33 @@ concurrency: jobs: unit: - uses: dbt-labs/dbt-adapters/.github/workflows/unit-tests.yml@config/release + name: Python ${{ matrix.python-version }} + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11"] + + steps: + - name: Check out repository + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Setup `hatch` + uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@config/release + with: + python-version: ${{ matrix.python-version }} + + - name: Run unit tests + run: hatch run unit-tests:all + shell: bash + + - name: Publish results + uses: dbt-labs/dbt-adapters/.github/actions/publish-results@config/release + if: always() + with: + source-file: "results.csv" + file-name: "unit_results" + python-version: ${{ matrix.python-version }} From eb736657f2d4a2672a10e766844008f8e529a637 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Fri, 26 Jan 2024 17:45:07 -0500 Subject: [PATCH 06/96] pass credentials through for postgres setup --- .github/workflows/integration-tests.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index bc471d08..8215e83e 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -25,11 +25,15 @@ jobs: matrix: python-version: ["3.8", "3.9", "3.10", "3.11"] + env: + DBT_INVOCATION_ENV: github-actions + DBT_TEST_USER_1: dbt_test_user_1 + DBT_TEST_USER_2: dbt_test_user_2 + DBT_TEST_USER_3: dbt_test_user_3 + steps: - name: Check out repository uses: actions/checkout@v4 - with: - persist-credentials: false - name: Setup `hatch` uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@config/release From d59cbe701b2ddc83d714eefe4900cf4a7d9b30fb Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Fri, 26 Jan 2024 18:00:49 -0500 Subject: [PATCH 07/96] limit integration tests to ubuntu for testing --- .github/workflows/integration-tests.yml | 26 ++++++------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 8215e83e..cf25b1c1 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -16,42 +16,28 @@ concurrency: cancel-in-progress: true jobs: - unit: + integration: name: Python ${{ matrix.python-version }} runs-on: ubuntu-latest + timeout-minutes: 30 strategy: fail-fast: false matrix: python-version: ["3.8", "3.9", "3.10", "3.11"] - env: - DBT_INVOCATION_ENV: github-actions - DBT_TEST_USER_1: dbt_test_user_1 - DBT_TEST_USER_2: dbt_test_user_2 - DBT_TEST_USER_3: dbt_test_user_3 - steps: - name: Check out repository - uses: actions/checkout@v4 + uses: actions/checkout@v3 + + - name: Set up postgres + uses: ./.github/actions/setup-postgres-linux - name: Setup `hatch` uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@config/release with: python-version: ${{ matrix.python-version }} - - name: Set up postgres (linux) - if: runner.os == 'Linux' - uses: ./.github/actions/setup-postgres-linux - - - name: Set up postgres (macos) - if: runner.os == 'macOS' - uses: ./.github/actions/setup-postgres-macos - - - name: Set up postgres (windows) - if: runner.os == 'Windows' - uses: ./.github/actions/setup-postgres-windows - - name: Run integration tests run: hatch run integration-tests:all shell: bash From b69a91f089a8c29f64da4fa72e8ad89039522ae5 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Fri, 26 Jan 2024 18:13:02 -0500 Subject: [PATCH 08/96] make setup_db.sh executable --- .github/actions/setup-postgres-linux/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 1c8fc772..285c2cb3 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -7,4 +7,5 @@ runs: run: | sudo systemctl start postgresql.service pg_isready + chmod +x ${{ github.action_path }}/setup_db.sh sudo -u postgres bash ${{ github.action_path }}/setup_db.sh From 3cb86c6eccb389b2bb5b2f6350dc4c0aec70f8f0 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Fri, 26 Jan 2024 18:14:56 -0500 Subject: [PATCH 09/96] revert to the original action --- .github/actions/setup-postgres-linux/action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 285c2cb3..1c8fc772 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -7,5 +7,4 @@ runs: run: | sudo systemctl start postgresql.service pg_isready - chmod +x ${{ github.action_path }}/setup_db.sh sudo -u postgres bash ${{ github.action_path }}/setup_db.sh From af7b7d53496c2facd417c1b0781e6275ffb56fd6 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Fri, 26 Jan 2024 18:21:57 -0500 Subject: [PATCH 10/96] break apart action into two steps, move script into scripts folder --- .../actions/setup-postgres-linux/action.yml | 21 ++++++++++++------- .../setup_postgres_linux.sh} | 0 2 files changed, 13 insertions(+), 8 deletions(-) rename .github/{actions/setup-postgres-linux/setup_db.sh => scripts/setup_postgres_linux.sh} (100%) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 1c8fc772..b5fa381d 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -1,10 +1,15 @@ -name: "Set up postgres (linux)" -description: "Set up postgres service on linux vm for dbt integration tests" +name: Set up postgres (linux) +description: Set up and configure postgres database on linux for integration tests + runs: - using: "composite" + using: composite steps: - - shell: bash - run: | - sudo systemctl start postgresql.service - pg_isready - sudo -u postgres bash ${{ github.action_path }}/setup_db.sh + + - name: Start postgres service + run: sudo systemctl start postgresql.service && pg_isready + shell: bash + + - name: Configure database + shell: bash + run: ./setup_postgres_linux.sh + working-directory: ./.github/scripts diff --git a/.github/actions/setup-postgres-linux/setup_db.sh b/.github/scripts/setup_postgres_linux.sh similarity index 100% rename from .github/actions/setup-postgres-linux/setup_db.sh rename to .github/scripts/setup_postgres_linux.sh From ca2ad1e427427c08606664bf40db7c84ed316822 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 14:52:10 -0500 Subject: [PATCH 11/96] put the config script back in the same terminal as the postgres server service --- .github/actions/setup-postgres-linux/action.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index b5fa381d..e0f9f542 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -6,10 +6,9 @@ runs: steps: - name: Start postgres service - run: sudo systemctl start postgresql.service && pg_isready + run: | + sudo systemctl start postgresql.service + pg_isready + ./setup_postgres_linux.sh shell: bash - - - name: Configure database - shell: bash - run: ./setup_postgres_linux.sh working-directory: ./.github/scripts From 794f29b790024a5cf4b55f335ef7a3847790b258 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 14:58:18 -0500 Subject: [PATCH 12/96] roll back the version of ubuntu to match dbt-core --- .github/workflows/integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index cf25b1c1..4ada48d3 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -18,7 +18,7 @@ concurrency: jobs: integration: name: Python ${{ matrix.python-version }} - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 timeout-minutes: 30 strategy: From 89ec6316626072441fbe2d8612355e8facaf5991 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 15:02:31 -0500 Subject: [PATCH 13/96] elevate privileges when running the db script --- .github/actions/setup-postgres-linux/action.yml | 9 +++++---- .github/workflows/integration-tests.yml | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index e0f9f542..45d54311 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -6,9 +6,10 @@ runs: steps: - name: Start postgres service - run: | - sudo systemctl start postgresql.service - pg_isready - ./setup_postgres_linux.sh + run: sudo systemctl start postgresql.service && pg_isready + shell: bash + + - name: Start postgres service + run: sudo -u postgres bash ./setup_postgres_linux.sh shell: bash working-directory: ./.github/scripts diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 4ada48d3..cf25b1c1 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -18,7 +18,7 @@ concurrency: jobs: integration: name: Python ${{ matrix.python-version }} - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest timeout-minutes: 30 strategy: From 6134705b739b827effa067d190bd46da0b3e718d Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 15:05:29 -0500 Subject: [PATCH 14/96] avoid a cd --- .github/actions/setup-postgres-linux/action.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 45d54311..85de1567 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -10,6 +10,5 @@ runs: shell: bash - name: Start postgres service - run: sudo -u postgres bash ./setup_postgres_linux.sh + run: sudo -u postgres bash ./.github/scripts/setup_postgres_linux.sh shell: bash - working-directory: ./.github/scripts From 4f2865d0f5493b09206f9c48a4b8b2ce98b24167 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 15:08:13 -0500 Subject: [PATCH 15/96] move db config script into action directory --- .github/actions/setup-postgres-linux/action.yml | 2 +- .../setup-postgres-linux/setup_db.sh} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename .github/{scripts/setup_postgres_linux.sh => actions/setup-postgres-linux/setup_db.sh} (100%) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 85de1567..3081acea 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -10,5 +10,5 @@ runs: shell: bash - name: Start postgres service - run: sudo -u postgres bash ./.github/scripts/setup_postgres_linux.sh + run: sudo -u postgres bash ${{ github.action_path }}/setup_db.sh shell: bash diff --git a/.github/scripts/setup_postgres_linux.sh b/.github/actions/setup-postgres-linux/setup_db.sh similarity index 100% rename from .github/scripts/setup_postgres_linux.sh rename to .github/actions/setup-postgres-linux/setup_db.sh From 3c6a45776f5fedaab4ee1343d1e2850263105c8c Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 15:16:48 -0500 Subject: [PATCH 16/96] setup python before postgres --- .github/workflows/integration-tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index cf25b1c1..ac047f41 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -30,14 +30,14 @@ jobs: - name: Check out repository uses: actions/checkout@v3 - - name: Set up postgres - uses: ./.github/actions/setup-postgres-linux - - name: Setup `hatch` uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@config/release with: python-version: ${{ matrix.python-version }} + - name: Set up postgres + uses: ./.github/actions/setup-postgres-linux + - name: Run integration tests run: hatch run integration-tests:all shell: bash From f4d74a13295214bf255333df4b6bec056b7347fc Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 15:30:58 -0500 Subject: [PATCH 17/96] add required environment variables --- .github/workflows/integration-tests.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index ac047f41..ae983deb 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -10,6 +10,18 @@ on: permissions: read-all +env: + DBT_INVOCATION_ENV: github-actions + DBT_TEST_USER_1: dbt_test_user_1 + DBT_TEST_USER_2: dbt_test_user_2 + DBT_TEST_USER_3: dbt_test_user_3 + POSTGRES_TEST_HOST: localhost + POSTGRES_TEST_PORT: 5432 + POSTGRES_TEST_USER: root + POSTGRES_TEST_PASS: password + POSTGRES_TEST_DATABASE: dbt + POSTGRES_TEST_THREADS: 4 + # will cancel previous workflows triggered by the same event and for the same ref for PRs or same SHA otherwise concurrency: group: ${{ github.workflow }}-${{ github.event_name }}-${{ contains(github.event_name, 'pull_request') && github.event.pull_request.head.ref || github.sha }} @@ -28,7 +40,7 @@ jobs: steps: - name: Check out repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup `hatch` uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@config/release From 69f73e60d3401da30780586c0ae9a539e5724591 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 16:37:25 -0500 Subject: [PATCH 18/96] make the file executable --- .github/actions/setup-postgres-linux/action.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 3081acea..8c79a8a1 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -1,14 +1,18 @@ name: Set up postgres (linux) -description: Set up and configure postgres database on linux for integration tests +description: Set up and configure a postgres database on linux for integration tests runs: using: composite steps: - - name: Start postgres service - run: sudo systemctl start postgresql.service && pg_isready + - name: Start the postgres service + run: | + sudo systemctl start postgresql.service + pg_isready shell: bash - - name: Start postgres service - run: sudo -u postgres bash ${{ github.action_path }}/setup_db.sh + - name: Configure the database + run: | + chmod +x ${{ github.action_path }}/setup_db.sh + sudo -u postgres bash ${{ github.action_path }}/setup_db.sh shell: bash From 4a926cfeb8c6f4395afe16eafb53c63bb352be0b Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 16:44:34 -0500 Subject: [PATCH 19/96] make the setup script executable --- .github/actions/setup-postgres-linux/action.yml | 5 +++-- .../setup_db.sh => scripts/setup_postgres_linux.sh} | 0 2 files changed, 3 insertions(+), 2 deletions(-) rename .github/{actions/setup-postgres-linux/setup_db.sh => scripts/setup_postgres_linux.sh} (100%) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 8c79a8a1..651e081f 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -13,6 +13,7 @@ runs: - name: Configure the database run: | - chmod +x ${{ github.action_path }}/setup_db.sh - sudo -u postgres bash ${{ github.action_path }}/setup_db.sh + chmod +x setup_postgres_linux.sh + sudo -u postgres bash setup_postgres_linux.sh shell: bash + working-directory: ./.github/scripts diff --git a/.github/actions/setup-postgres-linux/setup_db.sh b/.github/scripts/setup_postgres_linux.sh similarity index 100% rename from .github/actions/setup-postgres-linux/setup_db.sh rename to .github/scripts/setup_postgres_linux.sh From 3c9843ab0f41a36948921622ca92f6cab66c4232 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 16:48:05 -0500 Subject: [PATCH 20/96] move the action steps into the workflow --- .github/workflows/integration-tests.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index ae983deb..790b9a22 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -47,8 +47,18 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Set up postgres - uses: ./.github/actions/setup-postgres-linux + - name: Start the postgres service + run: | + sudo systemctl start postgresql.service + pg_isready + shell: bash + + - name: Configure the database + run: | + chmod +x setup_postgres_linux.sh + sudo -u postgres bash setup_postgres_linux.sh + shell: bash + working-directory: ./.github/scripts - name: Run integration tests run: hatch run integration-tests:all From cdf3548d00fdf79a7dc13217e0108aba147e758a Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 16:51:03 -0500 Subject: [PATCH 21/96] turn on persist credentials --- .github/workflows/integration-tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 790b9a22..b7f70c00 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -41,6 +41,8 @@ jobs: steps: - name: Check out repository uses: actions/checkout@v4 + with: + persist-credentials: true - name: Setup `hatch` uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@config/release @@ -54,9 +56,7 @@ jobs: shell: bash - name: Configure the database - run: | - chmod +x setup_postgres_linux.sh - sudo -u postgres bash setup_postgres_linux.sh + run: sudo -u postgres bash setup_postgres_linux.sh shell: bash working-directory: ./.github/scripts From 860d3dbe3ac53d1396e357af222a5a15293b7858 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 17:01:26 -0500 Subject: [PATCH 22/96] remove working dir arg --- .github/actions/setup-postgres-linux/action.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 651e081f..2215dfc9 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -12,8 +12,5 @@ runs: shell: bash - name: Configure the database - run: | - chmod +x setup_postgres_linux.sh - sudo -u postgres bash setup_postgres_linux.sh + run: sudo -u postgres bash ./.github/scripts/setup_postgres_linux.sh shell: bash - working-directory: ./.github/scripts From d875cfa42e4ecd41cc3b4c3d48e959b653841143 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 17:05:57 -0500 Subject: [PATCH 23/96] add print statement for debugging --- .../actions/setup-postgres-linux/action.yml | 7 +++---- .github/scripts/setup_postgres_linux.sh | 20 ++----------------- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 2215dfc9..32bf025e 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -6,11 +6,10 @@ runs: steps: - name: Start the postgres service - run: | - sudo systemctl start postgresql.service - pg_isready + run: sudo systemctl start postgresql.service shell: bash - name: Configure the database - run: sudo -u postgres bash ./.github/scripts/setup_postgres_linux.sh + run: sudo -u postgres bash setup_postgres_linux.sh shell: bash + working-directory: ./.github/scripts diff --git a/.github/scripts/setup_postgres_linux.sh b/.github/scripts/setup_postgres_linux.sh index de59bf0f..3a12f105 100755 --- a/.github/scripts/setup_postgres_linux.sh +++ b/.github/scripts/setup_postgres_linux.sh @@ -11,24 +11,6 @@ PGPORT="${PGPORT:-5432}" export PGPORT PGHOST="${PGHOST:-localhost}" -function connect_circle() { - # try to handle circleci/docker oddness - let rc=1 - while [[ $rc -eq 1 ]]; do - nc -z ${PGHOST} ${PGPORT} - let rc=$? - done - if [[ $rc -ne 0 ]]; then - echo "Fatal: Could not connect to $PGHOST" - exit 1 - fi -} - -# appveyor doesn't have 'nc', but it also doesn't have these issues -if [[ -n $CIRCLECI ]]; then - connect_circle -fi - for i in {1..10}; do if pg_isready -h "${PGHOST}" -p "${PGPORT}" -U "${PGUSER}" ; then break @@ -38,6 +20,8 @@ for i in {1..10}; do sleep 2; done; +echo "Postgres is running" + createdb dbt psql -c "CREATE ROLE root WITH PASSWORD 'password';" psql -c "ALTER ROLE root WITH LOGIN;" From 71e2604e3eed05fb01f16f47eadc1c5cfe28ea2d Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 17:29:47 -0500 Subject: [PATCH 24/96] move database configuration into sql file --- .github/actions/setup-postgres-linux/action.yml | 4 ++-- .github/scripts/setup_postgres_linux.sh | 3 --- .github/workflows/integration-tests.yml | 12 ++---------- scripts/setup_test_database.sql | 16 ++++++++++++++++ 4 files changed, 20 insertions(+), 15 deletions(-) create mode 100644 scripts/setup_test_database.sql diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 32bf025e..9e49c4ae 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -10,6 +10,6 @@ runs: shell: bash - name: Configure the database - run: sudo -u postgres bash setup_postgres_linux.sh + run: sudo -u postgres psql -f setup_test_database.sql shell: bash - working-directory: ./.github/scripts + working-directory: ./scripts diff --git a/.github/scripts/setup_postgres_linux.sh b/.github/scripts/setup_postgres_linux.sh index 3a12f105..f52da735 100755 --- a/.github/scripts/setup_postgres_linux.sh +++ b/.github/scripts/setup_postgres_linux.sh @@ -15,13 +15,10 @@ for i in {1..10}; do if pg_isready -h "${PGHOST}" -p "${PGPORT}" -U "${PGUSER}" ; then break fi - echo "Waiting for postgres to be ready..." sleep 2; done; -echo "Postgres is running" - createdb dbt psql -c "CREATE ROLE root WITH PASSWORD 'password';" psql -c "ALTER ROLE root WITH LOGIN;" diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index b7f70c00..278c8e98 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -49,16 +49,8 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Start the postgres service - run: | - sudo systemctl start postgresql.service - pg_isready - shell: bash - - - name: Configure the database - run: sudo -u postgres bash setup_postgres_linux.sh - shell: bash - working-directory: ./.github/scripts + - name: Setup postgres + uses: ./.github/actions/setup-postgres-linux - name: Run integration tests run: hatch run integration-tests:all diff --git a/scripts/setup_test_database.sql b/scripts/setup_test_database.sql new file mode 100644 index 00000000..8da2c0be --- /dev/null +++ b/scripts/setup_test_database.sql @@ -0,0 +1,16 @@ +CREATE DATABASE dbt; + +CREATE ROLE root WITH PASSWORD 'password'; +ALTER ROLE root WITH LOGIN; +GRANT CREATE, CONNECT ON DATABASE dbt TO root WITH GRANT OPTION; + +CREATE ROLE noaccess WITH PASSWORD 'password' NOSUPERUSER; +ALTER ROLE noaccess WITH LOGIN; +GRANT CONNECT ON DATABASE dbt TO noaccess; + +CREATE ROLE dbt_test_user_1; +CREATE ROLE dbt_test_user_2; +CREATE ROLE dbt_test_user_3; + +CREATE DATABASE "dbtMixedCase"; +GRANT CREATE, CONNECT ON DATABASE "dbtMixedCase" TO root WITH GRANT OPTION; From afd5001b03dbd8ed8e5a3d11c702516b0dd3456d Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 17:38:42 -0500 Subject: [PATCH 25/96] update script call --- .github/actions/setup-postgres-linux/action.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 9e49c4ae..e72b549a 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -10,6 +10,5 @@ runs: shell: bash - name: Configure the database - run: sudo -u postgres psql -f setup_test_database.sql + run: sudo su - postgres "psql -f ./scripts/setup_test_database.sql" shell: bash - working-directory: ./scripts From 453713b45a508f0f3f4ba0d5e4b23166a9069a3e Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 17:39:53 -0500 Subject: [PATCH 26/96] update script call --- .github/actions/setup-postgres-linux/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index e72b549a..1508b50a 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -10,5 +10,5 @@ runs: shell: bash - name: Configure the database - run: sudo su - postgres "psql -f ./scripts/setup_test_database.sql" + run: sudo su - postgres "pwd && psql -f ./scripts/setup_test_database.sql" shell: bash From e17b429fd73dc358df73d2ad0cf9304c00d1da7d Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 17:42:42 -0500 Subject: [PATCH 27/96] update script call --- .github/actions/setup-postgres-linux/action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 1508b50a..2616e61b 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -10,5 +10,6 @@ runs: shell: bash - name: Configure the database - run: sudo su - postgres "pwd && psql -f ./scripts/setup_test_database.sql" + run: sudo su - postgres "psql -f setup_test_database.sql" shell: bash + working-directory: ./scripts From a67511c3efd60db5b21ba732ff773f587b416274 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 17:44:12 -0500 Subject: [PATCH 28/96] update script call --- .github/actions/setup-postgres-linux/action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 2616e61b..944af897 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -10,6 +10,8 @@ runs: shell: bash - name: Configure the database - run: sudo su - postgres "psql -f setup_test_database.sql" + run: | + pwd + sudo su - postgres "psql -f setup_test_database.sql" shell: bash working-directory: ./scripts From c6756c1e9b58f22bba98e947160f112920d5f77c Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 17:45:50 -0500 Subject: [PATCH 29/96] update script call --- .github/actions/setup-postgres-linux/action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 944af897..501a9e9e 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -12,6 +12,7 @@ runs: - name: Configure the database run: | pwd - sudo su - postgres "psql -f setup_test_database.sql" + sudo su - postgres "pwd" + sudo su - postgres "psql -f ./setup_test_database.sql" shell: bash working-directory: ./scripts From 49c8519d41bc4e951021db608723390a21d659df Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 17:48:29 -0500 Subject: [PATCH 30/96] update script call --- .github/actions/setup-postgres-linux/action.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 501a9e9e..8e75577d 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -10,9 +10,6 @@ runs: shell: bash - name: Configure the database - run: | - pwd - sudo su - postgres "pwd" - sudo su - postgres "psql -f ./setup_test_database.sql" + run: sudo su - postgres "psql -f ./setup_test_database.sql" shell: bash working-directory: ./scripts From f3ecdbe8ac1f95be5e944a036ad3ddc96c93de83 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 17:53:42 -0500 Subject: [PATCH 31/96] update script call --- .github/actions/setup-postgres-linux/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 8e75577d..9e49c4ae 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -10,6 +10,6 @@ runs: shell: bash - name: Configure the database - run: sudo su - postgres "psql -f ./setup_test_database.sql" + run: sudo -u postgres psql -f setup_test_database.sql shell: bash working-directory: ./scripts From 9af286715549e6ece008d2e898b16bf472a3beb0 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 17:57:13 -0500 Subject: [PATCH 32/96] test empty script --- .github/actions/setup-postgres-linux/action.yml | 3 ++- scripts/echo.sh | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 scripts/echo.sh diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 9e49c4ae..4170dc70 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -10,6 +10,7 @@ runs: shell: bash - name: Configure the database - run: sudo -u postgres psql -f setup_test_database.sql + # run: sudo -u postgres psql -f setup_test_database.sql + run: echo.sh shell: bash working-directory: ./scripts diff --git a/scripts/echo.sh b/scripts/echo.sh new file mode 100644 index 00000000..cd6047ca --- /dev/null +++ b/scripts/echo.sh @@ -0,0 +1 @@ +echo "This is an empty script" \ No newline at end of file From ed931fd62ec3d70ddd2cda759461bc3790055a44 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 17:58:23 -0500 Subject: [PATCH 33/96] test empty script --- .github/actions/setup-postgres-linux/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 4170dc70..9d737197 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -11,6 +11,6 @@ runs: - name: Configure the database # run: sudo -u postgres psql -f setup_test_database.sql - run: echo.sh + run: ./echo.sh shell: bash working-directory: ./scripts From c2cefc205da29160f8ada6a1c7b27e9eb55c1c9b Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 18:01:53 -0500 Subject: [PATCH 34/96] test empty script --- .github/actions/setup-postgres-linux/action.yml | 3 +-- .github/workflows/integration-tests.yml | 11 +++++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 9d737197..9e49c4ae 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -10,7 +10,6 @@ runs: shell: bash - name: Configure the database - # run: sudo -u postgres psql -f setup_test_database.sql - run: ./echo.sh + run: sudo -u postgres psql -f setup_test_database.sql shell: bash working-directory: ./scripts diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 278c8e98..c8b7776a 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -41,16 +41,19 @@ jobs: steps: - name: Check out repository uses: actions/checkout@v4 - with: - persist-credentials: true - name: Setup `hatch` uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@config/release with: python-version: ${{ matrix.python-version }} - - name: Setup postgres - uses: ./.github/actions/setup-postgres-linux + - name: Run empty script + run: ./echo.sh + shell: bash + working-directory: ./scripts + +# - name: Setup postgres +# uses: ./.github/actions/setup-postgres-linux - name: Run integration tests run: hatch run integration-tests:all From 38b2adbc4d804cd02e39335d8b831ae1c899d821 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 18:08:56 -0500 Subject: [PATCH 35/96] test empty script --- {scripts => .github/scripts}/echo.sh | 0 .github/workflows/integration-tests.yml | 3 +-- 2 files changed, 1 insertion(+), 2 deletions(-) rename {scripts => .github/scripts}/echo.sh (100%) diff --git a/scripts/echo.sh b/.github/scripts/echo.sh similarity index 100% rename from scripts/echo.sh rename to .github/scripts/echo.sh diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index c8b7776a..e1d3b033 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -48,9 +48,8 @@ jobs: python-version: ${{ matrix.python-version }} - name: Run empty script - run: ./echo.sh + run: ./.github/scripts/echo.sh shell: bash - working-directory: ./scripts # - name: Setup postgres # uses: ./.github/actions/setup-postgres-linux From 5f847691d361886de92b4b580ddf100b1a69488f Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 18:14:25 -0500 Subject: [PATCH 36/96] test empty script --- .github/scripts/{echo.sh => empty_script.sh} | 0 .github/workflows/empty-script.yml | 23 ++++++++++++++++++++ .github/workflows/integration-tests.yml | 9 ++++---- 3 files changed, 27 insertions(+), 5 deletions(-) rename .github/scripts/{echo.sh => empty_script.sh} (100%) create mode 100644 .github/workflows/empty-script.yml diff --git a/.github/scripts/echo.sh b/.github/scripts/empty_script.sh similarity index 100% rename from .github/scripts/echo.sh rename to .github/scripts/empty_script.sh diff --git a/.github/workflows/empty-script.yml b/.github/workflows/empty-script.yml new file mode 100644 index 00000000..bce8eae2 --- /dev/null +++ b/.github/workflows/empty-script.yml @@ -0,0 +1,23 @@ +name: Empty Workflow + +on: + push: + branches: + - "main" + - "*.latest" + pull_request: + +permissions: read-all + +jobs: + integration: + name: Empty Workflow + runs-on: ubuntu-latest + + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Run empty script + run: ./.github/scripts/empty_script.sh + shell: bash diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index e1d3b033..e9d3e443 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -31,7 +31,6 @@ jobs: integration: name: Python ${{ matrix.python-version }} runs-on: ubuntu-latest - timeout-minutes: 30 strategy: fail-fast: false @@ -42,15 +41,15 @@ jobs: - name: Check out repository uses: actions/checkout@v4 + - name: Run empty script + run: ./.github/scripts/empty_script.sh + shell: bash + - name: Setup `hatch` uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@config/release with: python-version: ${{ matrix.python-version }} - - name: Run empty script - run: ./.github/scripts/echo.sh - shell: bash - # - name: Setup postgres # uses: ./.github/actions/setup-postgres-linux From 5348a7a41453b44c48d3f625d3cc25cea8b70264 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 18:23:13 -0500 Subject: [PATCH 37/96] test empty script --- .github/workflows/empty-script.yml | 14 +++++++------- {.github/scripts => scripts}/empty_script.sh | 0 2 files changed, 7 insertions(+), 7 deletions(-) rename {.github/scripts => scripts}/empty_script.sh (100%) diff --git a/.github/workflows/empty-script.yml b/.github/workflows/empty-script.yml index bce8eae2..c69a6996 100644 --- a/.github/workflows/empty-script.yml +++ b/.github/workflows/empty-script.yml @@ -1,3 +1,4 @@ +# https://docs.github.com/en/actions/learn-github-actions/essential-features-of-github-actions name: Empty Workflow on: @@ -10,14 +11,13 @@ on: permissions: read-all jobs: - integration: - name: Empty Workflow + example-job: runs-on: ubuntu-latest - + defaults: + run: + working-directory: ./scripts steps: - name: Check out repository uses: actions/checkout@v4 - - - name: Run empty script - run: ./.github/scripts/empty_script.sh - shell: bash + - name: Run script + run: ./empty_script.sh diff --git a/.github/scripts/empty_script.sh b/scripts/empty_script.sh similarity index 100% rename from .github/scripts/empty_script.sh rename to scripts/empty_script.sh From f9c66805a63f8aaf116108cfc16bb9d7cedc1202 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 18:25:14 -0500 Subject: [PATCH 38/96] test empty script --- .github/workflows/empty-script.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/empty-script.yml b/.github/workflows/empty-script.yml index c69a6996..4906c085 100644 --- a/.github/workflows/empty-script.yml +++ b/.github/workflows/empty-script.yml @@ -20,4 +20,4 @@ jobs: - name: Check out repository uses: actions/checkout@v4 - name: Run script - run: ./empty_script.sh + run: bash ./empty_script.sh From ef13ba4f86cad61b8e8190d5a7b16fb93c73bca0 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 18:25:59 -0500 Subject: [PATCH 39/96] test empty script --- .github/workflows/empty-script.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/empty-script.yml b/.github/workflows/empty-script.yml index 4906c085..47efd350 100644 --- a/.github/workflows/empty-script.yml +++ b/.github/workflows/empty-script.yml @@ -16,8 +16,9 @@ jobs: defaults: run: working-directory: ./scripts + shell: bash steps: - name: Check out repository uses: actions/checkout@v4 - name: Run script - run: bash ./empty_script.sh + run: ./empty_script.sh From d6f2907270576c5bc735fcd1eca4be69f7213e5b Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 18:33:56 -0500 Subject: [PATCH 40/96] test empty script --- .github/actions/setup-postgres-linux/action.yml | 3 +-- .../workflows/{empty-script.yml => example-job.yml} | 11 +++++------ .github/workflows/integration-tests.yml | 8 +++----- scripts/{empty_script.sh => my-script.sh} | 0 4 files changed, 9 insertions(+), 13 deletions(-) rename .github/workflows/{empty-script.yml => example-job.yml} (72%) rename scripts/{empty_script.sh => my-script.sh} (100%) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 9e49c4ae..74cb7aa7 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -10,6 +10,5 @@ runs: shell: bash - name: Configure the database - run: sudo -u postgres psql -f setup_test_database.sql + run: sudo -u postgres psql -f ./scripts/setup_test_database.sql shell: bash - working-directory: ./scripts diff --git a/.github/workflows/empty-script.yml b/.github/workflows/example-job.yml similarity index 72% rename from .github/workflows/empty-script.yml rename to .github/workflows/example-job.yml index 47efd350..73163ba9 100644 --- a/.github/workflows/empty-script.yml +++ b/.github/workflows/example-job.yml @@ -1,5 +1,4 @@ -# https://docs.github.com/en/actions/learn-github-actions/essential-features-of-github-actions -name: Empty Workflow +name: Example Job on: push: @@ -10,15 +9,15 @@ on: permissions: read-all +# https://docs.github.com/en/actions/learn-github-actions/essential-features-of-github-actions jobs: example-job: runs-on: ubuntu-latest defaults: run: working-directory: ./scripts - shell: bash steps: - - name: Check out repository + - name: Check out the repository to the runner uses: actions/checkout@v4 - - name: Run script - run: ./empty_script.sh + - name: Run a script + run: ./my-script.sh diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index e9d3e443..935ade7a 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -41,21 +41,19 @@ jobs: - name: Check out repository uses: actions/checkout@v4 - - name: Run empty script - run: ./.github/scripts/empty_script.sh - shell: bash - - name: Setup `hatch` uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@config/release with: python-version: ${{ matrix.python-version }} + - name: Run empty script + run: bash ./.github/scripts/empty_script.sh + # - name: Setup postgres # uses: ./.github/actions/setup-postgres-linux - name: Run integration tests run: hatch run integration-tests:all - shell: bash - name: Publish results uses: dbt-labs/dbt-adapters/.github/actions/publish-results@config/release diff --git a/scripts/empty_script.sh b/scripts/my-script.sh similarity index 100% rename from scripts/empty_script.sh rename to scripts/my-script.sh From 0c8df35f95a86dd7bb5fc754875c3c285d031ce1 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 18:37:07 -0500 Subject: [PATCH 41/96] test empty script --- .github/workflows/example-job.yml | 35 +++++++++++++++++++++++++ .github/workflows/integration-tests.yml | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/.github/workflows/example-job.yml b/.github/workflows/example-job.yml index 73163ba9..17cb9818 100644 --- a/.github/workflows/example-job.yml +++ b/.github/workflows/example-job.yml @@ -21,3 +21,38 @@ jobs: uses: actions/checkout@v4 - name: Run a script run: ./my-script.sh + + example-job-bash-default: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./scripts + shell: bash + steps: + - name: Check out the repository to the runner + uses: actions/checkout@v4 + - name: Run a script + run: ./my-script.sh + + example-job-bash-in-step: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./scripts + steps: + - name: Check out the repository to the runner + uses: actions/checkout@v4 + - name: Run a script + run: ./my-script.sh + shell: bash + + example-job-bash-inline: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./scripts + steps: + - name: Check out the repository to the runner + uses: actions/checkout@v4 + - name: Run a script + run: bash ./my-script.sh diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 935ade7a..19f6fe8b 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -47,7 +47,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Run empty script - run: bash ./.github/scripts/empty_script.sh + run: bash ./.github/scripts/my-script.sh # - name: Setup postgres # uses: ./.github/actions/setup-postgres-linux From cbbda05f7a30984a66a3190001ef4a43681b2e89 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 18:38:06 -0500 Subject: [PATCH 42/96] test empty script --- .github/workflows/integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 19f6fe8b..468e46cf 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -47,7 +47,7 @@ jobs: python-version: ${{ matrix.python-version }} - name: Run empty script - run: bash ./.github/scripts/my-script.sh + run: bash ./scripts/my-script.sh # - name: Setup postgres # uses: ./.github/actions/setup-postgres-linux From 0289ea6ef6c1b3f6e366c73495d53475f969f8dd Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 18:45:16 -0500 Subject: [PATCH 43/96] test empty script --- .../actions/setup-postgres-linux/action.yml | 6 ++- .../actions/setup-postgres-linux/setup_db.sh | 37 +++++++++++++++++++ .github/workflows/integration-tests.yml | 7 +--- 3 files changed, 44 insertions(+), 6 deletions(-) create mode 100755 .github/actions/setup-postgres-linux/setup_db.sh diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 74cb7aa7..67de5acc 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -9,6 +9,10 @@ runs: run: sudo systemctl start postgresql.service shell: bash +# - name: Configure the database +# run: sudo -u postgres psql -f ./scripts/setup_test_database.sql +# shell: bash + - name: Configure the database - run: sudo -u postgres psql -f ./scripts/setup_test_database.sql + run: sudo -u postgres bash ${{ github.action_path }}/setup_db.sh shell: bash diff --git a/.github/actions/setup-postgres-linux/setup_db.sh b/.github/actions/setup-postgres-linux/setup_db.sh new file mode 100755 index 00000000..f52da735 --- /dev/null +++ b/.github/actions/setup-postgres-linux/setup_db.sh @@ -0,0 +1,37 @@ +#!/bin/bash +set -x +env | grep '^PG' + +# If you want to run this script for your own postgresql (run with +# docker-compose) it will look like this: +# PGHOST=127.0.0.1 PGUSER=root PGPASSWORD=password PGDATABASE=postgres \ +PGUSER="${PGUSER:-postgres}" +export PGUSER +PGPORT="${PGPORT:-5432}" +export PGPORT +PGHOST="${PGHOST:-localhost}" + +for i in {1..10}; do + if pg_isready -h "${PGHOST}" -p "${PGPORT}" -U "${PGUSER}" ; then + break + fi + echo "Waiting for postgres to be ready..." + sleep 2; +done; + +createdb dbt +psql -c "CREATE ROLE root WITH PASSWORD 'password';" +psql -c "ALTER ROLE root WITH LOGIN;" +psql -c "GRANT CREATE, CONNECT ON DATABASE dbt TO root WITH GRANT OPTION;" + +psql -c "CREATE ROLE noaccess WITH PASSWORD 'password' NOSUPERUSER;" +psql -c "ALTER ROLE noaccess WITH LOGIN;" +psql -c "GRANT CONNECT ON DATABASE dbt TO noaccess;" +psql -c "CREATE ROLE dbt_test_user_1;" +psql -c "CREATE ROLE dbt_test_user_2;" +psql -c "CREATE ROLE dbt_test_user_3;" + +psql -c 'CREATE DATABASE "dbtMixedCase";' +psql -c 'GRANT CREATE, CONNECT ON DATABASE "dbtMixedCase" TO root WITH GRANT OPTION;' + +set +x diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 468e46cf..b02285dc 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -46,11 +46,8 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Run empty script - run: bash ./scripts/my-script.sh - -# - name: Setup postgres -# uses: ./.github/actions/setup-postgres-linux + - name: Setup postgres + uses: ./.github/actions/setup-postgres-linux - name: Run integration tests run: hatch run integration-tests:all From 0f6ba468c612d8f2724dee7523de93c9b044147c Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 18:48:19 -0500 Subject: [PATCH 44/96] test empty script --- .github/actions/setup-postgres-linux/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 67de5acc..d5d07258 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -14,5 +14,5 @@ runs: # shell: bash - name: Configure the database - run: sudo -u postgres bash ${{ github.action_path }}/setup_db.sh + run: sudo bash ${{ github.action_path }}/setup_db.sh shell: bash From 5fc4824a0b55a876b10eb86fdd936e7b1506eae8 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 18:49:34 -0500 Subject: [PATCH 45/96] test empty script --- .github/actions/setup-postgres-linux/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index d5d07258..67de5acc 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -14,5 +14,5 @@ runs: # shell: bash - name: Configure the database - run: sudo bash ${{ github.action_path }}/setup_db.sh + run: sudo -u postgres bash ${{ github.action_path }}/setup_db.sh shell: bash From e166b3ded06dfeb6a8dda51e8ae1868f46842d51 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 18:56:47 -0500 Subject: [PATCH 46/96] grant access to the file for postgres user --- .github/actions/setup-postgres-linux/action.yml | 4 +++- .github/workflows/example-job.yml | 6 ------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 67de5acc..d3ef266d 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -14,5 +14,7 @@ runs: # shell: bash - name: Configure the database - run: sudo -u postgres bash ${{ github.action_path }}/setup_db.sh + run: | + sudo chown -R postgres:postgres ${{ github.action_path }}/setup_db.sh + sudo -u postgres bash ${{ github.action_path }}/setup_db.sh shell: bash diff --git a/.github/workflows/example-job.yml b/.github/workflows/example-job.yml index 17cb9818..c17aad07 100644 --- a/.github/workflows/example-job.yml +++ b/.github/workflows/example-job.yml @@ -1,14 +1,8 @@ name: Example Job on: - push: - branches: - - "main" - - "*.latest" pull_request: -permissions: read-all - # https://docs.github.com/en/actions/learn-github-actions/essential-features-of-github-actions jobs: example-job: From 2ec2b443271f06301a7177c17463622beae46647 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 18:58:45 -0500 Subject: [PATCH 47/96] grant access to the file for postgres user --- .github/actions/setup-postgres-linux/action.yml | 8 +++++--- .github/workflows/example-job.yml | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index d3ef266d..7c9657d2 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -13,8 +13,10 @@ runs: # run: sudo -u postgres psql -f ./scripts/setup_test_database.sql # shell: bash + - name: Grant access to the file + run: sudo chown -R postgres:postgres ${{ github.action_path }}/setup_db.sh + shell: bash + - name: Configure the database - run: | - sudo chown -R postgres:postgres ${{ github.action_path }}/setup_db.sh - sudo -u postgres bash ${{ github.action_path }}/setup_db.sh + run: sudo -u postgres bash ${{ github.action_path }}/setup_db.sh shell: bash diff --git a/.github/workflows/example-job.yml b/.github/workflows/example-job.yml index c17aad07..0c546baf 100644 --- a/.github/workflows/example-job.yml +++ b/.github/workflows/example-job.yml @@ -2,6 +2,8 @@ name: Example Job on: pull_request: + branches: + - "*.latest" # https://docs.github.com/en/actions/learn-github-actions/essential-features-of-github-actions jobs: From e0ea031eb37b81d097429f096f5b22c1abb0d3e8 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 19:01:21 -0500 Subject: [PATCH 48/96] grant access to the file for postgres user --- .github/actions/setup-postgres-linux/action.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 7c9657d2..d61dc72f 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -9,14 +9,14 @@ runs: run: sudo systemctl start postgresql.service shell: bash -# - name: Configure the database -# run: sudo -u postgres psql -f ./scripts/setup_test_database.sql -# shell: bash - - name: Grant access to the file - run: sudo chown -R postgres:postgres ${{ github.action_path }}/setup_db.sh + run: sudo chown -R postgres:postgres ./scripts/setup_test_database.sql shell: bash - name: Configure the database - run: sudo -u postgres bash ${{ github.action_path }}/setup_db.sh + run: sudo -u postgres psql -f ./scripts/setup_test_database.sql shell: bash + +# - name: Configure the database +# run: sudo -u postgres bash ${{ github.action_path }}/setup_db.sh +# shell: bash From 73ca781af88da1f81d29dbe2b646945416be06d5 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 19:16:49 -0500 Subject: [PATCH 49/96] grant access to the file for postgres user --- .github/actions/setup-postgres-linux/action.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index d61dc72f..74eef833 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -6,17 +6,23 @@ runs: steps: - name: Start the postgres service + shell: bash run: sudo systemctl start postgresql.service + + - name: Grant access to the directory shell: bash + run: sudo chown -R 777 ./scripts - name: Grant access to the file - run: sudo chown -R postgres:postgres ./scripts/setup_test_database.sql shell: bash + run: sudo chown -R postgres:postgres setup_test_database.sql + working-directory: ./scripts - name: Configure the database - run: sudo -u postgres psql -f ./scripts/setup_test_database.sql shell: bash + run: sudo -u postgres psql -f setup_test_database.sql + working-directory: ./scripts # - name: Configure the database -# run: sudo -u postgres bash ${{ github.action_path }}/setup_db.sh # shell: bash +# run: sudo -u postgres bash ${{ github.action_path }}/setup_db.sh From c61e99eef46e30ee77d8ea79ff66a524aeb0ba7b Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Sat, 27 Jan 2024 19:17:44 -0500 Subject: [PATCH 50/96] grant access to the file for postgres user --- .github/actions/setup-postgres-linux/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 74eef833..0f6eb417 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -20,7 +20,7 @@ runs: - name: Configure the database shell: bash - run: sudo -u postgres psql -f setup_test_database.sql + run: sudo -u postgres psql -f ./setup_test_database.sql working-directory: ./scripts # - name: Configure the database From 9f706c1a886c3ad64e052afa2db815aeb6bf34a7 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 15:41:50 -0500 Subject: [PATCH 51/96] revert to core process --- .../actions/setup-postgres-linux/action.yml | 23 ++++--------------- .../actions/setup-postgres-linux/setup_db.sh | 19 +++++++++++++++ .github/workflows/integration-tests.yml | 11 ++++++--- 3 files changed, 31 insertions(+), 22 deletions(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 0f6eb417..d518dac1 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -7,22 +7,7 @@ runs: - name: Start the postgres service shell: bash - run: sudo systemctl start postgresql.service - - - name: Grant access to the directory - shell: bash - run: sudo chown -R 777 ./scripts - - - name: Grant access to the file - shell: bash - run: sudo chown -R postgres:postgres setup_test_database.sql - working-directory: ./scripts - - - name: Configure the database - shell: bash - run: sudo -u postgres psql -f ./setup_test_database.sql - working-directory: ./scripts - -# - name: Configure the database -# shell: bash -# run: sudo -u postgres bash ${{ github.action_path }}/setup_db.sh + run: | + sudo systemctl start postgresql.service + pg_isready + sudo -u postgres bash ${{ github.action_path }}/setup_db.sh diff --git a/.github/actions/setup-postgres-linux/setup_db.sh b/.github/actions/setup-postgres-linux/setup_db.sh index f52da735..de59bf0f 100755 --- a/.github/actions/setup-postgres-linux/setup_db.sh +++ b/.github/actions/setup-postgres-linux/setup_db.sh @@ -11,10 +11,29 @@ PGPORT="${PGPORT:-5432}" export PGPORT PGHOST="${PGHOST:-localhost}" +function connect_circle() { + # try to handle circleci/docker oddness + let rc=1 + while [[ $rc -eq 1 ]]; do + nc -z ${PGHOST} ${PGPORT} + let rc=$? + done + if [[ $rc -ne 0 ]]; then + echo "Fatal: Could not connect to $PGHOST" + exit 1 + fi +} + +# appveyor doesn't have 'nc', but it also doesn't have these issues +if [[ -n $CIRCLECI ]]; then + connect_circle +fi + for i in {1..10}; do if pg_isready -h "${PGHOST}" -p "${PGPORT}" -U "${PGUSER}" ; then break fi + echo "Waiting for postgres to be ready..." sleep 2; done; diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index b02285dc..cc650cb9 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -39,16 +39,21 @@ jobs: steps: - name: Check out repository - uses: actions/checkout@v4 + uses: actions/checkout@v3 - - name: Setup `hatch` - uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@config/release + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Setup postgres uses: ./.github/actions/setup-postgres-linux + - name: Setup `hatch` + uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@config/release + with: + python-version: ${{ matrix.python-version }} + - name: Run integration tests run: hatch run integration-tests:all From 978c0dbc29504ea1b62c4cad2beaac0c88e9954b Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 15:44:15 -0500 Subject: [PATCH 52/96] make the file executable --- .github/actions/setup-postgres-linux/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index d518dac1..27b9a359 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -10,4 +10,5 @@ runs: run: | sudo systemctl start postgresql.service pg_isready + sudo chmod +x ${{ github.action_path }}/setup_db.sh sudo -u postgres bash ${{ github.action_path }}/setup_db.sh From 04a94829ab26c8f7f29d39099844a2111f00ab03 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 15:45:55 -0500 Subject: [PATCH 53/96] make the file executable --- .github/actions/setup-postgres-linux/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 27b9a359..a9ee3212 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -10,5 +10,5 @@ runs: run: | sudo systemctl start postgresql.service pg_isready - sudo chmod +x ${{ github.action_path }}/setup_db.sh + sudo chmod a+x ${{ github.action_path }}/setup_db.sh sudo -u postgres bash ${{ github.action_path }}/setup_db.sh From 539243cf5402aaf515ee3260ae2140592b9909ef Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 15:47:19 -0500 Subject: [PATCH 54/96] woohoo --- .github/actions/setup-postgres-linux/action.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index a9ee3212..51688dea 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -7,8 +7,8 @@ runs: - name: Start the postgres service shell: bash - run: | - sudo systemctl start postgresql.service - pg_isready - sudo chmod a+x ${{ github.action_path }}/setup_db.sh - sudo -u postgres bash ${{ github.action_path }}/setup_db.sh + run: echo "woohoo" +# sudo systemctl start postgresql.service +# pg_isready +# sudo chmod a+x ${{ github.action_path }}/setup_db.sh +# sudo -u postgres bash ${{ github.action_path }}/setup_db.sh From 328d9ef328ded865b89b08706b83489267cade41 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 15:48:18 -0500 Subject: [PATCH 55/96] woohoo --- .github/actions/setup-postgres-linux/action.yml | 9 ++++----- .github/actions/setup-postgres-linux/setup_db.sh | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 51688dea..d518dac1 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -7,8 +7,7 @@ runs: - name: Start the postgres service shell: bash - run: echo "woohoo" -# sudo systemctl start postgresql.service -# pg_isready -# sudo chmod a+x ${{ github.action_path }}/setup_db.sh -# sudo -u postgres bash ${{ github.action_path }}/setup_db.sh + run: | + sudo systemctl start postgresql.service + pg_isready + sudo -u postgres bash ${{ github.action_path }}/setup_db.sh diff --git a/.github/actions/setup-postgres-linux/setup_db.sh b/.github/actions/setup-postgres-linux/setup_db.sh index de59bf0f..0d3f0a74 100755 --- a/.github/actions/setup-postgres-linux/setup_db.sh +++ b/.github/actions/setup-postgres-linux/setup_db.sh @@ -1,5 +1,6 @@ #!/bin/bash set -x +echo "woohoo" env | grep '^PG' # If you want to run this script for your own postgresql (run with From 1924c8e2d8ad30aa3249149034cad919734e9775 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 16:21:57 -0500 Subject: [PATCH 56/96] check permissions by running a stub script --- .github/actions/setup-postgres-linux/action.yml | 2 +- .github/workflows/integration-tests.yml | 9 --------- scripts/my-script.sh | 2 +- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index d518dac1..8ea61f6e 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -10,4 +10,4 @@ runs: run: | sudo systemctl start postgresql.service pg_isready - sudo -u postgres bash ${{ github.action_path }}/setup_db.sh + ./scripts/my-script.sh diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index cc650cb9..cca6d01a 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -11,10 +11,6 @@ on: permissions: read-all env: - DBT_INVOCATION_ENV: github-actions - DBT_TEST_USER_1: dbt_test_user_1 - DBT_TEST_USER_2: dbt_test_user_2 - DBT_TEST_USER_3: dbt_test_user_3 POSTGRES_TEST_HOST: localhost POSTGRES_TEST_PORT: 5432 POSTGRES_TEST_USER: root @@ -41,11 +37,6 @@ jobs: - name: Check out repository uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} - - name: Setup postgres uses: ./.github/actions/setup-postgres-linux diff --git a/scripts/my-script.sh b/scripts/my-script.sh index cd6047ca..29cd5c02 100644 --- a/scripts/my-script.sh +++ b/scripts/my-script.sh @@ -1 +1 @@ -echo "This is an empty script" \ No newline at end of file +echo "my-script.sh: Postgres is ready!" \ No newline at end of file From 55860974a6d3e7ae525bacff6d4bc9bf9dc15eb5 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 16:26:48 -0500 Subject: [PATCH 57/96] point actions back to dbt-adapters/main now that config-release was merged --- .github/workflows/code-quality.yml | 2 +- .github/workflows/integration-tests.yml | 4 ++-- .github/workflows/unit-tests.yml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index e3a9849e..5079161f 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -27,7 +27,7 @@ jobs: persist-credentials: false - name: Setup `hatch` - uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@config/release + uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@main - name: Run linters run: hatch run lint:all diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index cca6d01a..47e53400 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -41,7 +41,7 @@ jobs: uses: ./.github/actions/setup-postgres-linux - name: Setup `hatch` - uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@config/release + uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@main with: python-version: ${{ matrix.python-version }} @@ -49,7 +49,7 @@ jobs: run: hatch run integration-tests:all - name: Publish results - uses: dbt-labs/dbt-adapters/.github/actions/publish-results@config/release + uses: dbt-labs/dbt-adapters/.github/actions/publish-results@main if: always() with: source-file: "results.csv" diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index f377cfe7..ac42e9ac 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -32,7 +32,7 @@ jobs: persist-credentials: false - name: Setup `hatch` - uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@config/release + uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@main with: python-version: ${{ matrix.python-version }} @@ -41,7 +41,7 @@ jobs: shell: bash - name: Publish results - uses: dbt-labs/dbt-adapters/.github/actions/publish-results@config/release + uses: dbt-labs/dbt-adapters/.github/actions/publish-results@main if: always() with: source-file: "results.csv" From d128a74480a43ed6ee485f640e69a9c4aa78b629 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 18:19:39 -0500 Subject: [PATCH 58/96] call script directly --- .github/workflows/integration-tests.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 47e53400..5498c7c1 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -37,8 +37,11 @@ jobs: - name: Check out repository uses: actions/checkout@v3 - - name: Setup postgres - uses: ./.github/actions/setup-postgres-linux + - name: Run script + shell: bash + run: ./scripts/my-script.sh +# - name: Setup postgres +# uses: ./.github/actions/setup-postgres-linux - name: Setup `hatch` uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@main From 1115c6ec98ba46462c1c587eb5354e788b1e51e3 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 18:21:45 -0500 Subject: [PATCH 59/96] verify access to the scripts directory --- .github/workflows/integration-tests.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 5498c7c1..75c2c327 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -37,9 +37,17 @@ jobs: - name: Check out repository uses: actions/checkout@v3 - - name: Run script + - name: Can I `cd ./scripts`? shell: bash - run: ./scripts/my-script.sh + run: | + sudo chmod +x ./scripts/my-script.sh + ./scripts/my-script.sh + + - name: Can I run .scripts/my-script.sh? + shell: bash + run: | + sudo chmod +x ./scripts/my-script.sh + ./scripts/my-script.sh # - name: Setup postgres # uses: ./.github/actions/setup-postgres-linux From de3bb437e9a96c372aea9d76973bed858e0a8889 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 18:24:36 -0500 Subject: [PATCH 60/96] verify action has access to the scripts directory --- .github/actions/setup-postgres-linux/action.yml | 5 +++++ .github/workflows/integration-tests.yml | 15 ++------------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 8ea61f6e..c4ba1e9a 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -10,4 +10,9 @@ runs: run: | sudo systemctl start postgresql.service pg_isready + + - name: Configure the database + shell: bash + run: | + sudo chmod +x ./scripts/my-script.sh ./scripts/my-script.sh diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 75c2c327..47e53400 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -37,19 +37,8 @@ jobs: - name: Check out repository uses: actions/checkout@v3 - - name: Can I `cd ./scripts`? - shell: bash - run: | - sudo chmod +x ./scripts/my-script.sh - ./scripts/my-script.sh - - - name: Can I run .scripts/my-script.sh? - shell: bash - run: | - sudo chmod +x ./scripts/my-script.sh - ./scripts/my-script.sh -# - name: Setup postgres -# uses: ./.github/actions/setup-postgres-linux + - name: Setup postgres + uses: ./.github/actions/setup-postgres-linux - name: Setup `hatch` uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@main From 444780a09aa213a9bbe41fd7d5c6886ef58c3134 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 18:25:31 -0500 Subject: [PATCH 61/96] verify postgres user has access to the scripts directory --- .github/actions/setup-postgres-linux/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index c4ba1e9a..cc38e9d6 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -15,4 +15,4 @@ runs: shell: bash run: | sudo chmod +x ./scripts/my-script.sh - ./scripts/my-script.sh + sudo -u postgres bash ./scripts/my-script.sh From 254e3de2d6b405f844336c29fdeee4572ccf8440 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 18:27:09 -0500 Subject: [PATCH 62/96] swap with real script --- .github/actions/setup-postgres-linux/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index cc38e9d6..9f905b1c 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -14,5 +14,5 @@ runs: - name: Configure the database shell: bash run: | - sudo chmod +x ./scripts/my-script.sh - sudo -u postgres bash ./scripts/my-script.sh + sudo chmod +x ./scripts/setup_test_database.sql + sudo -u postgres psql -f ./scripts/setup_test_database.sql From 55758fcb2a7138b5519a3cba01b8cb3ba865b4cc Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 18:31:56 -0500 Subject: [PATCH 63/96] test connection to postgres with debug query --- .github/actions/setup-postgres-linux/action.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 9f905b1c..9e1597bf 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -13,6 +13,4 @@ runs: - name: Configure the database shell: bash - run: | - sudo chmod +x ./scripts/setup_test_database.sql - sudo -u postgres psql -f ./scripts/setup_test_database.sql + run: sudo su - postgres psql -c 'select 1 as id' From 01615fa280eacfccd39dcd5154851753edb774c7 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 18:32:50 -0500 Subject: [PATCH 64/96] test connection to postgres with debug query --- .github/actions/setup-postgres-linux/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 9e1597bf..6cf22e52 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -13,4 +13,4 @@ runs: - name: Configure the database shell: bash - run: sudo su - postgres psql -c 'select 1 as id' + run: sudo su - postgres psql -c 'select 1' From 8db60a49af80359c57b4c096eed290dd181356e2 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 18:34:32 -0500 Subject: [PATCH 65/96] test connection to postgres with debug query --- .github/actions/setup-postgres-linux/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 6cf22e52..2fcd0f47 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -13,4 +13,4 @@ runs: - name: Configure the database shell: bash - run: sudo su - postgres psql -c 'select 1' + run: sudo su - postgres psql -c 'select 1;' From fbc05bfccff2a8de754e8fe864b831843adbd37d Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 18:35:47 -0500 Subject: [PATCH 66/96] test connection to postgres with debug query --- .github/actions/setup-postgres-linux/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 2fcd0f47..55aa0947 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -13,4 +13,4 @@ runs: - name: Configure the database shell: bash - run: sudo su - postgres psql -c 'select 1;' + run: sudo su - postgres psql -c "select 1;" From 37474f8373f3844286fcbd82bf1e0413b6b2f4ec Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 18:37:39 -0500 Subject: [PATCH 67/96] test connection to postgres with debug query --- .github/actions/setup-postgres-linux/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 55aa0947..fb9a070d 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -13,4 +13,4 @@ runs: - name: Configure the database shell: bash - run: sudo su - postgres psql -c "select 1;" + run: sudo su - postgres createdb dbt From 15e9a3e572377b3cca9a57326f14b76495afe082 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 18:41:37 -0500 Subject: [PATCH 68/96] test connection to postgres with debug query --- .github/actions/setup-postgres-linux/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index fb9a070d..c4502a89 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -13,4 +13,4 @@ runs: - name: Configure the database shell: bash - run: sudo su - postgres createdb dbt + run: sudo -u postgres psql -c 'CREATE DATABASE dbt;' From 793647fb88fddff6f118c8752d7a85ed29de4068 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 18:44:22 -0500 Subject: [PATCH 69/96] test connection to postgres with debug query --- .github/actions/setup-postgres-linux/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index c4502a89..ce10eae6 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -13,4 +13,4 @@ runs: - name: Configure the database shell: bash - run: sudo -u postgres psql -c 'CREATE DATABASE dbt;' + run: sudo su - postgres psql -c 'CREATE DATABASE dbt;' From f807fd7d4303396162129301d9c5dd02c1f58ae4 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 18:50:52 -0500 Subject: [PATCH 70/96] test add environment variables from script --- .github/actions/setup-postgres-linux/action.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index ce10eae6..427c3982 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -14,3 +14,7 @@ runs: - name: Configure the database shell: bash run: sudo su - postgres psql -c 'CREATE DATABASE dbt;' + env: + PGUSER: postgres + PGPORT: 5432 + PGHOST: localhost From 23f02b60b61bf9b2858f688b71b1eb4745d4e3d2 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 18:53:13 -0500 Subject: [PATCH 71/96] test add environment variables from script --- .github/actions/setup-postgres-linux/action.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 427c3982..0d46b177 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -13,8 +13,11 @@ runs: - name: Configure the database shell: bash - run: sudo su - postgres psql -c 'CREATE DATABASE dbt;' - env: - PGUSER: postgres - PGPORT: 5432 - PGHOST: localhost + run: | + sudo su - postgres PGUSER=postgres + sudo su - postgres export PGUSER + sudo su - postgres PGPORT=5432 + sudo su - postgres export PGPORT + sudo su - postgres PGHOST=localhost + sudo su - postgres export PGHOST + sudo su - postgres createdb dbt From 22cdd60aefcdd56d625568368be3462cb87a3d43 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 18:54:19 -0500 Subject: [PATCH 72/96] test add environment variables from script --- .github/actions/setup-postgres-linux/action.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 0d46b177..4b21e2f2 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -14,10 +14,10 @@ runs: - name: Configure the database shell: bash run: | - sudo su - postgres PGUSER=postgres - sudo su - postgres export PGUSER - sudo su - postgres PGPORT=5432 - sudo su - postgres export PGPORT - sudo su - postgres PGHOST=localhost - sudo su - postgres export PGHOST - sudo su - postgres createdb dbt + sudo su - postgres bash PGUSER=postgres + sudo su - postgres bash export PGUSER + sudo su - postgres bash PGPORT=5432 + sudo su - postgres bash export PGPORT + sudo su - postgres bash PGHOST=localhost + sudo su - postgres bash export PGHOST + sudo su - postgres bash createdb dbt From 158e59ebcf613dbfadb330ed8446c50c8258dfe9 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 18:56:01 -0500 Subject: [PATCH 73/96] test add environment variables from script --- .github/actions/setup-postgres-linux/action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 4b21e2f2..3dc6a2eb 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -14,10 +14,10 @@ runs: - name: Configure the database shell: bash run: | - sudo su - postgres bash PGUSER=postgres + sudo su - postgres bash PGUSER="postgres" sudo su - postgres bash export PGUSER - sudo su - postgres bash PGPORT=5432 + sudo su - postgres bash PGPORT="5432" sudo su - postgres bash export PGPORT - sudo su - postgres bash PGHOST=localhost + sudo su - postgres bash PGHOST="localhost" sudo su - postgres bash export PGHOST sudo su - postgres bash createdb dbt From 2ff41676a193205488d1196ac3c971fe9e6f228a Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 18:56:59 -0500 Subject: [PATCH 74/96] test add environment variables from script --- .github/actions/setup-postgres-linux/action.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 3dc6a2eb..4d011b17 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -14,10 +14,10 @@ runs: - name: Configure the database shell: bash run: | - sudo su - postgres bash PGUSER="postgres" - sudo su - postgres bash export PGUSER - sudo su - postgres bash PGPORT="5432" - sudo su - postgres bash export PGPORT - sudo su - postgres bash PGHOST="localhost" - sudo su - postgres bash export PGHOST - sudo su - postgres bash createdb dbt + sudo su - postgres bash "PGUSER=postgres" + sudo su - postgres bash "export PGUSER" + sudo su - postgres bash "PGPORT=5432" + sudo su - postgres bash "export PGPORT" + sudo su - postgres bash "PGHOST=localhost" + sudo su - postgres bash "export PGHOST" + sudo su - postgres bash "createdb dbt" From fd3089d791a6b7e86eb1939fbb31fafeb28ba377 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 19:01:36 -0500 Subject: [PATCH 75/96] test add environment variables from script --- .github/actions/setup-postgres-linux/action.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 4d011b17..ccdadc41 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -13,11 +13,4 @@ runs: - name: Configure the database shell: bash - run: | - sudo su - postgres bash "PGUSER=postgres" - sudo su - postgres bash "export PGUSER" - sudo su - postgres bash "PGPORT=5432" - sudo su - postgres bash "export PGPORT" - sudo su - postgres bash "PGHOST=localhost" - sudo su - postgres bash "export PGHOST" - sudo su - postgres bash "createdb dbt" + run: sudo -u psql -c "CREATE DATABASE dbt;" From d7b46dc6875b595ac165421ae1d21ca22924ddb1 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 19:03:28 -0500 Subject: [PATCH 76/96] test add environment variables from script --- .github/actions/setup-postgres-linux/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index ccdadc41..e9d62621 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -13,4 +13,4 @@ runs: - name: Configure the database shell: bash - run: sudo -u psql -c "CREATE DATABASE dbt;" + run: sudo -u postgres psql -c "CREATE DATABASE dbt;" From 8569d4e328a97e609686be400238179415627138 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 19:06:28 -0500 Subject: [PATCH 77/96] test error message received --- .github/actions/setup-postgres-linux/action.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index e9d62621..15c8ae94 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -11,6 +11,13 @@ runs: sudo systemctl start postgresql.service pg_isready + - name: Can I cd "/home/runner/work/dbt-postgres/dbt-postgres"? + shell: bash + run: | + sudo -u postgres bash -c "pwd" + sudo -u postgres bash -c "ls" + sudo -u postgres bash -c "cd ." + - name: Configure the database shell: bash run: sudo -u postgres psql -c "CREATE DATABASE dbt;" From d79224753a17d60db2f22a3212d5ef918a1db81d Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 19:10:27 -0500 Subject: [PATCH 78/96] test error message received --- .github/actions/setup-postgres-linux/action.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 15c8ae94..3cb7ce63 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -9,7 +9,7 @@ runs: shell: bash run: | sudo systemctl start postgresql.service - pg_isready + pg_isready -h localhost -p 5432 -u postgres - name: Can I cd "/home/runner/work/dbt-postgres/dbt-postgres"? shell: bash @@ -17,6 +17,7 @@ runs: sudo -u postgres bash -c "pwd" sudo -u postgres bash -c "ls" sudo -u postgres bash -c "cd ." + sudo -u postgres bash -c "pwd" - name: Configure the database shell: bash From 308878df206534eb859af2bd2f9e3398a68f0e16 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 19:11:09 -0500 Subject: [PATCH 79/96] test error message received --- .github/actions/setup-postgres-linux/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 3cb7ce63..11bae57c 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -9,7 +9,7 @@ runs: shell: bash run: | sudo systemctl start postgresql.service - pg_isready -h localhost -p 5432 -u postgres + pg_isready -h localhost -p 5432 -U postgres - name: Can I cd "/home/runner/work/dbt-postgres/dbt-postgres"? shell: bash From 6989641a6c13709365f0ec7fb92f26bc12b29f8b Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 19:12:50 -0500 Subject: [PATCH 80/96] test error message received --- .github/actions/setup-postgres-linux/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml index 11bae57c..2ffe6e0e 100644 --- a/.github/actions/setup-postgres-linux/action.yml +++ b/.github/actions/setup-postgres-linux/action.yml @@ -21,4 +21,4 @@ runs: - name: Configure the database shell: bash - run: sudo -u postgres psql -c "CREATE DATABASE dbt;" + run: sudo su postgres psql -c "CREATE DATABASE dbt;" From c020dff591f7dd7d664db5489d90fa46027081de Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 19:26:47 -0500 Subject: [PATCH 81/96] try services approach --- .github/workflows/integration-tests.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 47e53400..a425fd9a 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -33,12 +33,26 @@ jobs: matrix: python-version: ["3.8", "3.9", "3.10", "3.11"] + services: + postgres: + image: postgres + env: + POSTGRES_PASSWORD: password + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 5432:5432 + steps: - name: Check out repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup postgres - uses: ./.github/actions/setup-postgres-linux + shell: bash + run: psql -d postgres -U root -a -f ./scripts/setup_test_database.sql - name: Setup `hatch` uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@main From aae803d7e45fec9334728dad0da14c0d3f168299 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 19:30:06 -0500 Subject: [PATCH 82/96] try services approach --- .github/workflows/integration-tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index a425fd9a..e099a677 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -37,7 +37,7 @@ jobs: postgres: image: postgres env: - POSTGRES_PASSWORD: password + POSTGRES_PASSWORD: postgres options: >- --health-cmd pg_isready --health-interval 10s @@ -52,7 +52,7 @@ jobs: - name: Setup postgres shell: bash - run: psql -d postgres -U root -a -f ./scripts/setup_test_database.sql + run: psql -d postgres -U postgres -a -f ./scripts/setup_test_database.sql - name: Setup `hatch` uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@main From e03a0ac1fe660a859923372543e8016ecffa5345 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 19:39:09 -0500 Subject: [PATCH 83/96] try services approach --- .github/workflows/integration-tests.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index e099a677..24acc35d 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -50,15 +50,17 @@ jobs: - name: Check out repository uses: actions/checkout@v4 - - name: Setup postgres - shell: bash - run: psql -d postgres -U postgres -a -f ./scripts/setup_test_database.sql - - name: Setup `hatch` uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@main with: python-version: ${{ matrix.python-version }} + - name: Setup postgres + shell: bash + run: psql -d postgres -U postgres -a -f ./scripts/setup_test_database.sql + env: + PGPASSWORD: postgres + - name: Run integration tests run: hatch run integration-tests:all From bbbf134eae98a1e3d7f6a6daf3a272b586c21b70 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Mon, 29 Jan 2024 19:44:33 -0500 Subject: [PATCH 84/96] try services approach --- .github/workflows/integration-tests.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 24acc35d..7ebc97ee 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -57,7 +57,9 @@ jobs: - name: Setup postgres shell: bash - run: psql -d postgres -U postgres -a -f ./scripts/setup_test_database.sql + run: | + apt update && apt-get install postgresql + psql -d postgres -U postgres -a -f ./scripts/setup_test_database.sql env: PGPASSWORD: postgres From 402fc97d2f92c4317c12544f68a7b5e719c3578b Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Tue, 30 Jan 2024 10:39:33 -0500 Subject: [PATCH 85/96] try services approach --- .github/workflows/integration-tests.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 7ebc97ee..06d2abf0 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -57,9 +57,7 @@ jobs: - name: Setup postgres shell: bash - run: | - apt update && apt-get install postgresql - psql -d postgres -U postgres -a -f ./scripts/setup_test_database.sql + run: psql -d postgres -U postgres -c "select 1" env: PGPASSWORD: postgres From 1b48fbb1bdf803899a6ff3699004a075003cf9f4 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Tue, 30 Jan 2024 10:42:45 -0500 Subject: [PATCH 86/96] try services approach --- .github/workflows/integration-tests.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 06d2abf0..52fc7d02 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -50,17 +50,17 @@ jobs: - name: Check out repository uses: actions/checkout@v4 - - name: Setup `hatch` - uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@main - with: - python-version: ${{ matrix.python-version }} - - name: Setup postgres shell: bash run: psql -d postgres -U postgres -c "select 1" env: PGPASSWORD: postgres + - name: Setup `hatch` + uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@main + with: + python-version: ${{ matrix.python-version }} + - name: Run integration tests run: hatch run integration-tests:all From 3f37ba1e7dbe6d1f20f7cce1294c807a0d5a4db0 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Tue, 30 Jan 2024 10:46:59 -0500 Subject: [PATCH 87/96] try services approach --- .github/workflows/integration-tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 52fc7d02..c8fb1292 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -50,6 +50,10 @@ jobs: - name: Check out repository uses: actions/checkout@v4 + - name: Look for postgres + shell: bash + run: pg_isready -h localhost -p 5432 -U postgres + - name: Setup postgres shell: bash run: psql -d postgres -U postgres -c "select 1" From 0728a1b257f68304e55262ed87b9fcbafe3847d4 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Tue, 30 Jan 2024 10:49:39 -0500 Subject: [PATCH 88/96] try services approach --- .github/workflows/integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index c8fb1292..b21a78b5 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -52,7 +52,7 @@ jobs: - name: Look for postgres shell: bash - run: pg_isready -h localhost -p 5432 -U postgres + run: pg_isready -h localhost -p 5432 -d postgres -U postgres - name: Setup postgres shell: bash From be230c433b1db3e9f3fc2f9eb08a7c76fafe2dd2 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Tue, 30 Jan 2024 10:50:54 -0500 Subject: [PATCH 89/96] try services approach --- .github/workflows/integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index b21a78b5..2c4e311c 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -56,7 +56,7 @@ jobs: - name: Setup postgres shell: bash - run: psql -d postgres -U postgres -c "select 1" + run: psql -h localhost -p 5432 -d postgres -U postgres -c "select 1" env: PGPASSWORD: postgres From a7b926461b8daf46e7a9c8fb216c2ed2fa0543eb Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Tue, 30 Jan 2024 10:54:51 -0500 Subject: [PATCH 90/96] try services approach --- .github/workflows/integration-tests.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 2c4e311c..9a16cce3 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -50,15 +50,15 @@ jobs: - name: Check out repository uses: actions/checkout@v4 - - name: Look for postgres - shell: bash - run: pg_isready -h localhost -p 5432 -d postgres -U postgres - - name: Setup postgres shell: bash - run: psql -h localhost -p 5432 -d postgres -U postgres -c "select 1" + run: psql -f ./scripts/setup_test_database.sql env: + PGHOST: localhost + PGPORT: 5432 + PGUSER: postgres PGPASSWORD: postgres + PGDATABASE: postgres - name: Setup `hatch` uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@main From 5f1bfda16302ea25751afa8d1ef81ed61ee370af Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Tue, 30 Jan 2024 11:04:32 -0500 Subject: [PATCH 91/96] run integration tests in ci --- .../actions/setup-postgres-linux/action.yml | 24 -------- .../actions/setup-postgres-linux/setup_db.sh | 57 ------------------- .../actions/setup-postgres-macos/action.yml | 24 -------- .../actions/setup-postgres-macos/setup_db.sh | 56 ------------------ .../actions/setup-postgres-windows/action.yml | 12 ---- .../setup-postgres-windows/setup_db.sh | 56 ------------------ .github/scripts/setup_postgres_linux.sh | 37 ------------ scripts/my-script.sh | 1 - tests/functional/test_experimental_parser.py | 2 +- 9 files changed, 1 insertion(+), 268 deletions(-) delete mode 100644 .github/actions/setup-postgres-linux/action.yml delete mode 100755 .github/actions/setup-postgres-linux/setup_db.sh delete mode 100644 .github/actions/setup-postgres-macos/action.yml delete mode 100755 .github/actions/setup-postgres-macos/setup_db.sh delete mode 100644 .github/actions/setup-postgres-windows/action.yml delete mode 100755 .github/actions/setup-postgres-windows/setup_db.sh delete mode 100755 .github/scripts/setup_postgres_linux.sh delete mode 100644 scripts/my-script.sh diff --git a/.github/actions/setup-postgres-linux/action.yml b/.github/actions/setup-postgres-linux/action.yml deleted file mode 100644 index 2ffe6e0e..00000000 --- a/.github/actions/setup-postgres-linux/action.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Set up postgres (linux) -description: Set up and configure a postgres database on linux for integration tests - -runs: - using: composite - steps: - - - name: Start the postgres service - shell: bash - run: | - sudo systemctl start postgresql.service - pg_isready -h localhost -p 5432 -U postgres - - - name: Can I cd "/home/runner/work/dbt-postgres/dbt-postgres"? - shell: bash - run: | - sudo -u postgres bash -c "pwd" - sudo -u postgres bash -c "ls" - sudo -u postgres bash -c "cd ." - sudo -u postgres bash -c "pwd" - - - name: Configure the database - shell: bash - run: sudo su postgres psql -c "CREATE DATABASE dbt;" diff --git a/.github/actions/setup-postgres-linux/setup_db.sh b/.github/actions/setup-postgres-linux/setup_db.sh deleted file mode 100755 index 0d3f0a74..00000000 --- a/.github/actions/setup-postgres-linux/setup_db.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash -set -x -echo "woohoo" -env | grep '^PG' - -# If you want to run this script for your own postgresql (run with -# docker-compose) it will look like this: -# PGHOST=127.0.0.1 PGUSER=root PGPASSWORD=password PGDATABASE=postgres \ -PGUSER="${PGUSER:-postgres}" -export PGUSER -PGPORT="${PGPORT:-5432}" -export PGPORT -PGHOST="${PGHOST:-localhost}" - -function connect_circle() { - # try to handle circleci/docker oddness - let rc=1 - while [[ $rc -eq 1 ]]; do - nc -z ${PGHOST} ${PGPORT} - let rc=$? - done - if [[ $rc -ne 0 ]]; then - echo "Fatal: Could not connect to $PGHOST" - exit 1 - fi -} - -# appveyor doesn't have 'nc', but it also doesn't have these issues -if [[ -n $CIRCLECI ]]; then - connect_circle -fi - -for i in {1..10}; do - if pg_isready -h "${PGHOST}" -p "${PGPORT}" -U "${PGUSER}" ; then - break - fi - - echo "Waiting for postgres to be ready..." - sleep 2; -done; - -createdb dbt -psql -c "CREATE ROLE root WITH PASSWORD 'password';" -psql -c "ALTER ROLE root WITH LOGIN;" -psql -c "GRANT CREATE, CONNECT ON DATABASE dbt TO root WITH GRANT OPTION;" - -psql -c "CREATE ROLE noaccess WITH PASSWORD 'password' NOSUPERUSER;" -psql -c "ALTER ROLE noaccess WITH LOGIN;" -psql -c "GRANT CONNECT ON DATABASE dbt TO noaccess;" -psql -c "CREATE ROLE dbt_test_user_1;" -psql -c "CREATE ROLE dbt_test_user_2;" -psql -c "CREATE ROLE dbt_test_user_3;" - -psql -c 'CREATE DATABASE "dbtMixedCase";' -psql -c 'GRANT CREATE, CONNECT ON DATABASE "dbtMixedCase" TO root WITH GRANT OPTION;' - -set +x diff --git a/.github/actions/setup-postgres-macos/action.yml b/.github/actions/setup-postgres-macos/action.yml deleted file mode 100644 index af9a9fe1..00000000 --- a/.github/actions/setup-postgres-macos/action.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: "Set up postgres (macos)" -description: "Set up postgres service on macos vm for dbt integration tests" -runs: - using: "composite" - steps: - - shell: bash - run: | - brew services start postgresql - echo "Check PostgreSQL service is running" - i=10 - COMMAND='pg_isready' - while [ $i -gt -1 ]; do - if [ $i == 0 ]; then - echo "PostgreSQL service not ready, all attempts exhausted" - exit 1 - fi - echo "Check PostgreSQL service status" - eval $COMMAND && break - echo "PostgreSQL service not ready, wait 10 more sec, attempts left: $i" - sleep 10 - ((i--)) - done - createuser -s postgres - bash ${{ github.action_path }}/setup_db.sh diff --git a/.github/actions/setup-postgres-macos/setup_db.sh b/.github/actions/setup-postgres-macos/setup_db.sh deleted file mode 100755 index de59bf0f..00000000 --- a/.github/actions/setup-postgres-macos/setup_db.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash -set -x -env | grep '^PG' - -# If you want to run this script for your own postgresql (run with -# docker-compose) it will look like this: -# PGHOST=127.0.0.1 PGUSER=root PGPASSWORD=password PGDATABASE=postgres \ -PGUSER="${PGUSER:-postgres}" -export PGUSER -PGPORT="${PGPORT:-5432}" -export PGPORT -PGHOST="${PGHOST:-localhost}" - -function connect_circle() { - # try to handle circleci/docker oddness - let rc=1 - while [[ $rc -eq 1 ]]; do - nc -z ${PGHOST} ${PGPORT} - let rc=$? - done - if [[ $rc -ne 0 ]]; then - echo "Fatal: Could not connect to $PGHOST" - exit 1 - fi -} - -# appveyor doesn't have 'nc', but it also doesn't have these issues -if [[ -n $CIRCLECI ]]; then - connect_circle -fi - -for i in {1..10}; do - if pg_isready -h "${PGHOST}" -p "${PGPORT}" -U "${PGUSER}" ; then - break - fi - - echo "Waiting for postgres to be ready..." - sleep 2; -done; - -createdb dbt -psql -c "CREATE ROLE root WITH PASSWORD 'password';" -psql -c "ALTER ROLE root WITH LOGIN;" -psql -c "GRANT CREATE, CONNECT ON DATABASE dbt TO root WITH GRANT OPTION;" - -psql -c "CREATE ROLE noaccess WITH PASSWORD 'password' NOSUPERUSER;" -psql -c "ALTER ROLE noaccess WITH LOGIN;" -psql -c "GRANT CONNECT ON DATABASE dbt TO noaccess;" -psql -c "CREATE ROLE dbt_test_user_1;" -psql -c "CREATE ROLE dbt_test_user_2;" -psql -c "CREATE ROLE dbt_test_user_3;" - -psql -c 'CREATE DATABASE "dbtMixedCase";' -psql -c 'GRANT CREATE, CONNECT ON DATABASE "dbtMixedCase" TO root WITH GRANT OPTION;' - -set +x diff --git a/.github/actions/setup-postgres-windows/action.yml b/.github/actions/setup-postgres-windows/action.yml deleted file mode 100644 index 419b5e26..00000000 --- a/.github/actions/setup-postgres-windows/action.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: "Set up postgres (windows)" -description: "Set up postgres service on windows vm for dbt integration tests" -runs: - using: "composite" - steps: - - shell: pwsh - run: | - $pgService = Get-Service -Name postgresql* - Set-Service -InputObject $pgService -Status running -StartupType automatic - Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait -PassThru - $env:Path += ";$env:PGBIN" - bash ${{ github.action_path }}/setup_db.sh diff --git a/.github/actions/setup-postgres-windows/setup_db.sh b/.github/actions/setup-postgres-windows/setup_db.sh deleted file mode 100755 index de59bf0f..00000000 --- a/.github/actions/setup-postgres-windows/setup_db.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash -set -x -env | grep '^PG' - -# If you want to run this script for your own postgresql (run with -# docker-compose) it will look like this: -# PGHOST=127.0.0.1 PGUSER=root PGPASSWORD=password PGDATABASE=postgres \ -PGUSER="${PGUSER:-postgres}" -export PGUSER -PGPORT="${PGPORT:-5432}" -export PGPORT -PGHOST="${PGHOST:-localhost}" - -function connect_circle() { - # try to handle circleci/docker oddness - let rc=1 - while [[ $rc -eq 1 ]]; do - nc -z ${PGHOST} ${PGPORT} - let rc=$? - done - if [[ $rc -ne 0 ]]; then - echo "Fatal: Could not connect to $PGHOST" - exit 1 - fi -} - -# appveyor doesn't have 'nc', but it also doesn't have these issues -if [[ -n $CIRCLECI ]]; then - connect_circle -fi - -for i in {1..10}; do - if pg_isready -h "${PGHOST}" -p "${PGPORT}" -U "${PGUSER}" ; then - break - fi - - echo "Waiting for postgres to be ready..." - sleep 2; -done; - -createdb dbt -psql -c "CREATE ROLE root WITH PASSWORD 'password';" -psql -c "ALTER ROLE root WITH LOGIN;" -psql -c "GRANT CREATE, CONNECT ON DATABASE dbt TO root WITH GRANT OPTION;" - -psql -c "CREATE ROLE noaccess WITH PASSWORD 'password' NOSUPERUSER;" -psql -c "ALTER ROLE noaccess WITH LOGIN;" -psql -c "GRANT CONNECT ON DATABASE dbt TO noaccess;" -psql -c "CREATE ROLE dbt_test_user_1;" -psql -c "CREATE ROLE dbt_test_user_2;" -psql -c "CREATE ROLE dbt_test_user_3;" - -psql -c 'CREATE DATABASE "dbtMixedCase";' -psql -c 'GRANT CREATE, CONNECT ON DATABASE "dbtMixedCase" TO root WITH GRANT OPTION;' - -set +x diff --git a/.github/scripts/setup_postgres_linux.sh b/.github/scripts/setup_postgres_linux.sh deleted file mode 100755 index f52da735..00000000 --- a/.github/scripts/setup_postgres_linux.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -set -x -env | grep '^PG' - -# If you want to run this script for your own postgresql (run with -# docker-compose) it will look like this: -# PGHOST=127.0.0.1 PGUSER=root PGPASSWORD=password PGDATABASE=postgres \ -PGUSER="${PGUSER:-postgres}" -export PGUSER -PGPORT="${PGPORT:-5432}" -export PGPORT -PGHOST="${PGHOST:-localhost}" - -for i in {1..10}; do - if pg_isready -h "${PGHOST}" -p "${PGPORT}" -U "${PGUSER}" ; then - break - fi - echo "Waiting for postgres to be ready..." - sleep 2; -done; - -createdb dbt -psql -c "CREATE ROLE root WITH PASSWORD 'password';" -psql -c "ALTER ROLE root WITH LOGIN;" -psql -c "GRANT CREATE, CONNECT ON DATABASE dbt TO root WITH GRANT OPTION;" - -psql -c "CREATE ROLE noaccess WITH PASSWORD 'password' NOSUPERUSER;" -psql -c "ALTER ROLE noaccess WITH LOGIN;" -psql -c "GRANT CONNECT ON DATABASE dbt TO noaccess;" -psql -c "CREATE ROLE dbt_test_user_1;" -psql -c "CREATE ROLE dbt_test_user_2;" -psql -c "CREATE ROLE dbt_test_user_3;" - -psql -c 'CREATE DATABASE "dbtMixedCase";' -psql -c 'GRANT CREATE, CONNECT ON DATABASE "dbtMixedCase" TO root WITH GRANT OPTION;' - -set +x diff --git a/scripts/my-script.sh b/scripts/my-script.sh deleted file mode 100644 index 29cd5c02..00000000 --- a/scripts/my-script.sh +++ /dev/null @@ -1 +0,0 @@ -echo "my-script.sh: Postgres is ready!" \ No newline at end of file diff --git a/tests/functional/test_experimental_parser.py b/tests/functional/test_experimental_parser.py index 18ee8525..9064ee4f 100644 --- a/tests/functional/test_experimental_parser.py +++ b/tests/functional/test_experimental_parser.py @@ -1,7 +1,7 @@ import os +from dbt.context.providers import RefArgs from dbt.contracts.graph.manifest import Manifest -from dbt.contracts.graph.nodes import RefArgs import pytest from tests.functional.utils import run_dbt, run_dbt_and_capture From efc346e5638b1dd32550cba0e397d0681b064475 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Tue, 30 Jan 2024 11:49:12 -0500 Subject: [PATCH 92/96] remove debugging artifacts --- .github/workflows/example-job.yml | 54 ------------------------------- 1 file changed, 54 deletions(-) delete mode 100644 .github/workflows/example-job.yml diff --git a/.github/workflows/example-job.yml b/.github/workflows/example-job.yml deleted file mode 100644 index 0c546baf..00000000 --- a/.github/workflows/example-job.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Example Job - -on: - pull_request: - branches: - - "*.latest" - -# https://docs.github.com/en/actions/learn-github-actions/essential-features-of-github-actions -jobs: - example-job: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./scripts - steps: - - name: Check out the repository to the runner - uses: actions/checkout@v4 - - name: Run a script - run: ./my-script.sh - - example-job-bash-default: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./scripts - shell: bash - steps: - - name: Check out the repository to the runner - uses: actions/checkout@v4 - - name: Run a script - run: ./my-script.sh - - example-job-bash-in-step: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./scripts - steps: - - name: Check out the repository to the runner - uses: actions/checkout@v4 - - name: Run a script - run: ./my-script.sh - shell: bash - - example-job-bash-inline: - runs-on: ubuntu-latest - defaults: - run: - working-directory: ./scripts - steps: - - name: Check out the repository to the runner - uses: actions/checkout@v4 - - name: Run a script - run: bash ./my-script.sh From a78dd72a9a4842cafaad65fbd8bbdee255a865cc Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Tue, 30 Jan 2024 11:49:36 -0500 Subject: [PATCH 93/96] re-scope environment variables to specific step --- .github/workflows/integration-tests.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 9a16cce3..af04542d 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -10,14 +10,6 @@ on: permissions: read-all -env: - POSTGRES_TEST_HOST: localhost - POSTGRES_TEST_PORT: 5432 - POSTGRES_TEST_USER: root - POSTGRES_TEST_PASS: password - POSTGRES_TEST_DATABASE: dbt - POSTGRES_TEST_THREADS: 4 - # will cancel previous workflows triggered by the same event and for the same ref for PRs or same SHA otherwise concurrency: group: ${{ github.workflow }}-${{ github.event_name }}-${{ contains(github.event_name, 'pull_request') && github.event.pull_request.head.ref || github.sha }} @@ -67,6 +59,13 @@ jobs: - name: Run integration tests run: hatch run integration-tests:all + env: + POSTGRES_TEST_HOST: localhost + POSTGRES_TEST_PORT: 5432 + POSTGRES_TEST_USER: root + POSTGRES_TEST_PASS: password + POSTGRES_TEST_DATABASE: dbt + POSTGRES_TEST_THREADS: 4 - name: Publish results uses: dbt-labs/dbt-adapters/.github/actions/publish-results@main From 33ae245ed59b4b5c5e4c2e37964e0068771f5aa3 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Tue, 30 Jan 2024 11:49:59 -0500 Subject: [PATCH 94/96] remove leading "- " to avoid false positives --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 9f73d36e..c9ad0e50 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -99,7 +99,7 @@ features = [ detached = true features = ["lint"] [tool.hatch.envs.lint.scripts] -all = ["- black", "- flake8", ] +all = ["black", "flake8"] black = "python -m black ." flake8 = "python -m flake8 ." From ab04416ca92c01bf436a2e2f4f1402ed13ef535a Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Tue, 30 Jan 2024 11:50:25 -0500 Subject: [PATCH 95/96] remove adapters-irrelevant tests --- tests/functional/test_init.py | 49 ----------------------------------- 1 file changed, 49 deletions(-) diff --git a/tests/functional/test_init.py b/tests/functional/test_init.py index 43f0fcc2..1c3133c8 100644 --- a/tests/functional/test_init.py +++ b/tests/functional/test_init.py @@ -420,55 +420,6 @@ def setup(self, project): os.remove(os.path.join(project.project_root, "dbt_project.yml")) -class TestInitInvalidProjectNameCLI(TestInitOutsideOfProjectBase): - @patch("dbt.task.init._get_adapter_plugin_names") - @patch("click.confirm") - @patch("click.prompt") - def test_init_invalid_project_name_cli( - self, mock_prompt, mock_confirm, mock_get_adapter, project_name, project - ): - manager = Mock() - manager.attach_mock(mock_prompt, "prompt") - manager.attach_mock(mock_confirm, "confirm") - - invalid_name = "name-with-hyphen" - valid_name = project_name - manager.prompt.side_effect = [valid_name] - mock_get_adapter.return_value = [project.adapter.type()] - - run_dbt(["init", invalid_name, "--skip-profile-setup"]) - manager.assert_has_calls( - [ - call.prompt("Enter a name for your project (letters, digits, underscore)"), - ] - ) - - -class TestInitInvalidProjectNamePrompt(TestInitOutsideOfProjectBase): - @patch("dbt.task.init._get_adapter_plugin_names") - @patch("click.confirm") - @patch("click.prompt") - def test_init_invalid_project_name_prompt( - self, mock_prompt, mock_confirm, mock_get_adapter, project_name, project - ): - manager = Mock() - manager.attach_mock(mock_prompt, "prompt") - manager.attach_mock(mock_confirm, "confirm") - - invalid_name = "name-with-hyphen" - valid_name = project_name - manager.prompt.side_effect = [invalid_name, valid_name] - mock_get_adapter.return_value = [project.adapter.type()] - - run_dbt(["init", "--skip-profile-setup"]) - manager.assert_has_calls( - [ - call.prompt("Enter a name for your project (letters, digits, underscore)"), - call.prompt("Enter a name for your project (letters, digits, underscore)"), - ] - ) - - class TestInitInsideProjectAndSkipProfileSetup(TestInitInsideOfProjectBase): @patch("dbt.task.init._get_adapter_plugin_names") @patch("click.confirm") From fb5f047c4d0487ff84545f6c20518aa404015785 Mon Sep 17 00:00:00 2001 From: Mike Alfare Date: Tue, 30 Jan 2024 11:52:09 -0500 Subject: [PATCH 96/96] remove adapters-irrelevant tests --- .../functional/minimal_cli/test_minimal_cli.py | 10 ---------- .../schema_tests/test_schema_v2_tests.py | 18 ------------------ 2 files changed, 28 deletions(-) diff --git a/tests/functional/minimal_cli/test_minimal_cli.py b/tests/functional/minimal_cli/test_minimal_cli.py index 64bcb1f1..1fccbbd0 100644 --- a/tests/functional/minimal_cli/test_minimal_cli.py +++ b/tests/functional/minimal_cli/test_minimal_cli.py @@ -30,16 +30,6 @@ def test_deps(self, runner, project): assert "1.0.0" in result.output -class TestLS(BaseConfigProject): - def test_ls(self, runner, project): - runner.invoke(cli, ["deps"]) - ls_result = runner.invoke(cli, ["ls"]) - assert "1 seed" in ls_result.output - assert "1 model" in ls_result.output - assert "5 data tests" in ls_result.output - assert "1 snapshot" in ls_result.output - - class TestBuild(BaseConfigProject): def test_build(self, runner, project): runner.invoke(cli, ["deps"]) diff --git a/tests/functional/schema_tests/test_schema_v2_tests.py b/tests/functional/schema_tests/test_schema_v2_tests.py index 79771c50..a268f096 100644 --- a/tests/functional/schema_tests/test_schema_v2_tests.py +++ b/tests/functional/schema_tests/test_schema_v2_tests.py @@ -892,24 +892,6 @@ def test_collision_test_names_get_hash( assert test_results[1].node.unique_id in expected_unique_ids -class TestGenericTestsCollide: - @pytest.fixture(scope="class") - def models(self): - return { - "schema.yml": dupe_generic_tests_collide__schema_yml, - "model_a.sql": dupe_generic_tests_collide__model_a, - } - - def test_generic_test_collision( - self, - project, - ): - """These tests collide, since only the configs differ""" - with pytest.raises(DuplicateResourceNameError) as exc: - run_dbt() - assert "dbt found two tests with the name" in str(exc.value) - - class TestGenericTestsConfigCustomMacros: @pytest.fixture(scope="class") def models(self):