diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index dda07beda2..b36bf64121 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -83,21 +83,21 @@ jobs: uses: ./.github/actions/setup-nix with: authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - tools: tests.testSpec.bin tests.testIO.bin tests.testBigSchema.bin withTools.postgresql-${{ matrix.pgVersion }}.bin cabalTools.update.bin + tools: tests.testSpec.bin tests.testIO.bin tests.testBigSchema.bin withTools.pg-${{ matrix.pgVersion }}.bin cabalTools.update.bin - run: postgrest-cabal-update - name: Run spec tests if: always() - run: postgrest-with-postgresql-${{ matrix.pgVersion }} postgrest-test-spec + run: postgrest-with-pg-${{ matrix.pgVersion }} postgrest-test-spec - name: Run IO tests if: always() - run: postgrest-with-postgresql-${{ matrix.pgVersion }} postgrest-test-io -vv + run: postgrest-with-pg-${{ matrix.pgVersion }} postgrest-test-io -vv - name: Run IO tests on a big schema if: always() - run: postgrest-with-postgresql-${{ matrix.pgVersion }} postgrest-test-big-schema -vv + run: postgrest-with-pg-${{ matrix.pgVersion }} postgrest-test-big-schema -vv memory: diff --git a/default.nix b/default.nix index 23a8dc3947..e9c3353779 100644 --- a/default.nix +++ b/default.nix @@ -53,11 +53,11 @@ let postgresqlVersions = [ - { name = "postgresql-17"; postgresql = pkgs.postgresql_17.withPackages (p: [ p.postgis p.pg_safeupdate ]); } - { name = "postgresql-16"; postgresql = pkgs.postgresql_16.withPackages (p: [ p.postgis p.pg_safeupdate ]); } - { name = "postgresql-15"; postgresql = pkgs.postgresql_15.withPackages (p: [ p.postgis p.pg_safeupdate ]); } - { name = "postgresql-14"; postgresql = pkgs.postgresql_14.withPackages (p: [ p.postgis p.pg_safeupdate ]); } - { name = "postgresql-13"; postgresql = pkgs.postgresql_13.withPackages (p: [ p.postgis p.pg_safeupdate ]); } + { name = "pg-17"; postgresql = pkgs.postgresql_17.withPackages (p: [ p.postgis p.pg_safeupdate ]); } + { name = "pg-16"; postgresql = pkgs.postgresql_16.withPackages (p: [ p.postgis p.pg_safeupdate ]); } + { name = "pg-15"; postgresql = pkgs.postgresql_15.withPackages (p: [ p.postgis p.pg_safeupdate ]); } + { name = "pg-14"; postgresql = pkgs.postgresql_14.withPackages (p: [ p.postgis p.pg_safeupdate ]); } + { name = "pg-13"; postgresql = pkgs.postgresql_13.withPackages (p: [ p.postgis p.pg_safeupdate ]); } ]; haskellPackages = pkgs.haskell.packages."${compiler}"; diff --git a/nix/README.md b/nix/README.md index 9a0cb7b8c7..cc4b4ef59c 100644 --- a/nix/README.md +++ b/nix/README.md @@ -91,11 +91,11 @@ postgrest-gen-ctags postgrest-watch postgrest-gen-jwt postgrest-with-all postgrest-gen-secret postgrest-with-git postgrest-git-hooks postgrest-with-pgrst -postgrest-hsie-graph-modules postgrest-with-postgresql-13 -postgrest-hsie-graph-symbols postgrest-with-postgresql-14 -postgrest-hsie-minimal-imports postgrest-with-postgresql-15 -postgrest-lint postgrest-with-postgresql-16 -postgrest-loadtest postgrest-with-postgresql-17 +postgrest-hsie-graph-modules postgrest-with-pg-13 +postgrest-hsie-graph-symbols postgrest-with-pg-14 +postgrest-hsie-minimal-imports postgrest-with-pg-15 +postgrest-lint postgrest-with-pg-16 +postgrest-loadtest postgrest-with-pg-17 postgrest-loadtest-against postgrest-with-slow-pg postgrest-loadtest-report postgrest-with-slow-postgrest postgrest-nixpkgs-upgrade @@ -174,7 +174,7 @@ $ nix-shell --run "postgrest-with-all postgrest-test-spec" # Run the tests against a specific version of PostgreSQL (use tab-completion in # nix-shell to see all available versions): -$ nix-shell --run "postgrest-with-postgresql-13 postgrest-test-spec" +$ nix-shell --run "postgrest-with-pg-13 postgrest-test-spec" ``` @@ -284,7 +284,7 @@ Tools like `postgrest-build`, `postgrest-run`, `postgrest-repl` etc. are simple also run in CI, with the exception of the IO and Memory checks that need to be run separately. -`postgrest-with-postgresql-*` take a command as an argument and will run it +`postgrest-with-pg-*` take a command as an argument and will run it with a temporary database. `postgrest-with-all` will run the command against all supported PostgreSQL versions. Tests run without `postgrest-with-*` are run against the latest PostgreSQL version by default. diff --git a/nix/tools/withTools.nix b/nix/tools/withTools.nix index e91dc8091b..2f6afe4c41 100644 --- a/nix/tools/withTools.nix +++ b/nix/tools/withTools.nix @@ -46,7 +46,7 @@ let } # Avoid starting multiple layers of withTmpDb, but make sure to have the last invocation - # load fixtures. Otherwise postgrest-with-postgresql-xx postgrest-test-io would not be possible. + # load fixtures. Otherwise postgrest-with-pg-xx postgrest-test-io would not be possible. if ! test -v PGHOST; then mkdir -p "$tmpdir"/{db,socket} @@ -74,7 +74,13 @@ let >> "$setuplog" log "Starting the database cluster..." + # Instead of listening on a local port, we will listen on a unix domain socket. + # NOTE: unix domain socket filename name must remain under max limit. + # On Linux, it's 108 chars (including '\0' terminator) + # On MacOS, it's 104 chars + # See: https://serverfault.com/questions/641347/check-if-a-path-exceeds-maximum-for-unix-domain-socket + pg_ctl -l "$tmpdir/db.log" -w start -o "-F -c listen_addresses=\"\" -c hba_file=$HBA_FILE -k $PGHOST -c log_statement=\"all\" " \ >> "$setuplog" @@ -433,7 +439,7 @@ buildToolbox withSlowPg withSlowPgrst; } // builtins.listToAttrs ( - # Create a `postgrest-with-postgresql-` for each PostgreSQL version + # Create a `postgrest-with-pg-` for each PostgreSQL version builtins.map (pg: { inherit (pg) name; value = withTmpDb pg; }) postgresqlVersions ); # make latest withPg available for other nix files diff --git a/test/io/big_schema.sql b/test/io/big_schema.sql index ea56c51232..34027c7d22 100644 --- a/test/io/big_schema.sql +++ b/test/io/big_schema.sql @@ -5,7 +5,7 @@ We use it to test our metadata generation because it contains a good amount of d Custom roles and privileges were removed. -postgrest-with-postgresql-14 -f test/io/big_schema.sql psql +postgrest-with-pg-14 -f test/io/big_schema.sql psql Has 12 functions: diff --git a/test/pgbench/README.md b/test/pgbench/README.md index d0d6a71bae..ef147e103e 100644 --- a/test/pgbench/README.md +++ b/test/pgbench/README.md @@ -3,9 +3,9 @@ Can be used as: ``` -postgrest-with-postgresql-15 -f test/pgbench/fixtures.sql pgbench -U postgres -n -T 10 -f test/pgbench/1567/old.sql +postgrest-with-pg-15 -f test/pgbench/fixtures.sql pgbench -U postgres -n -T 10 -f test/pgbench/1567/old.sql -postgrest-with-postgresql-15 -f test/pgbench/fixtures.sql pgbench -U postgres -n -T 10 -f test/pgbench/1567/new.sql +postgrest-with-pg-15 -f test/pgbench/fixtures.sql pgbench -U postgres -n -T 10 -f test/pgbench/1567/new.sql ``` ## Directory structure