diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2a03d42..eabe029 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -25,10 +25,10 @@ jobs: authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} - name: Build - run: nix-shell --argstr pgVersion "${{ matrix.pg-version }}" --arg cassert false --run "xpg -v ${{ matrix.pg-version }} build" + run: nix-shell --argstr pgVersion "${{ matrix.pg-version }}" --arg cassert true --run "xpg -v ${{ matrix.pg-version }} build" - name: Run tests - run: nix-shell --argstr pgVersion "${{ matrix.pg-version }}" --arg cassert false --run "xpg -v ${{ matrix.pg-version }} test" + run: nix-shell --argstr pgVersion "${{ matrix.pg-version }}" --arg cassert true --run "xpg -v ${{ matrix.pg-version }} test" test-on-macos: runs-on: macos-26 @@ -55,10 +55,10 @@ jobs: rm -rf ./build-${{ matrix.pg-version }} - name: Build - run: nix-shell --argstr pgVersion "${{ matrix.pg-version }}" --arg cassert false --run "xpg -v ${{ matrix.pg-version }} build" + run: nix-shell --argstr pgVersion "${{ matrix.pg-version }}" --arg cassert true --run "xpg -v ${{ matrix.pg-version }} build" - name: Run tests - run: nix-shell --argstr pgVersion "${{ matrix.pg-version }}" --arg cassert false --run "xpg -v ${{ matrix.pg-version }} test" + run: nix-shell --argstr pgVersion "${{ matrix.pg-version }}" --arg cassert true --run "xpg -v ${{ matrix.pg-version }} test" loadtest: runs-on: ubuntu-latest diff --git a/flake.lock b/flake.lock index 704715e..0f9a553 100644 --- a/flake.lock +++ b/flake.lock @@ -43,16 +43,16 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1791394750, - "narHash": "sha256-SMv4EKUaGmfUyXyeGHW3AiX1vbef7El56RKTIxio8jQ=", + "lastModified": 1793674321, + "narHash": "sha256-wLcCioA8+xi7ck/gdZmBeZo/NJfXxvYYCVOpAGvCgK8=", "owner": "supabase", "repo": "xpg", - "rev": "8f2a2005e8e020e0db5a7cbb94a87a9dd3227411", + "rev": "27aedcb0a23bce2879e7b114369e9c937665082d", "type": "github" }, "original": { "owner": "supabase", - "ref": "v2.6.0", + "ref": "v2.7.0", "repo": "xpg", "type": "github" } diff --git a/flake.nix b/flake.nix index f34b991..6e9ca56 100644 --- a/flake.nix +++ b/flake.nix @@ -6,7 +6,7 @@ nixpkgs.url = "github:NixOS/nixpkgs/91c9a64ce2a84e648d0cf9671274bb9c2fb9ba60"; xpg = { - url = "github:supabase/xpg/v2.6.0"; + url = "github:supabase/xpg/v2.7.0"; }; }; diff --git a/test/test_misc.py b/test/test_misc.py index c523db2..11dc43d 100644 --- a/test/test_misc.py +++ b/test/test_misc.py @@ -1,3 +1,13 @@ + +def get_pg_version(conn) -> int: + (pg_version,) = conn.execute( + """ + select current_setting('server_version_num'); + """ + ).fetchone() + return int(pg_version) + + def test_plpgsql_check(conn): """ Test check all plpgsql functions (functions or trigger functions with defined @@ -33,4 +43,10 @@ def test_plpgsql_check(conn): ) ss ORDER BY (pcf).functionid::regprocedure::text, (pcf).lineno; """ - assert len(conn.execute(sql).fetchall()) == 2 + + # The function random_delay_ms that defined in test/utils/loadtest.sql makes use of + # the postgres function random_normal which only exists in pg16 and beyond. This + # conditional assignment fixes issues resulting from that. + expected_warnings = (3 if get_pg_version(conn) < 160000 else 2) + + assert len(conn.execute(sql).fetchall()) == expected_warnings