Skip to content

Commit 71ada9d

Browse files
committed
nix: shorten postgrest-with-postgresql-xx scripts
Renames these scripts to `postgrest-with-pg-xx`. The renaming helps reduce the length of temporary filenames. This is needed to ensure that socket file names remain under the maximum allowed length of 107 chars. Closes #4461. Signed-off-by: Taimoor Zaeem <[email protected]>
1 parent 91abcd4 commit 71ada9d

File tree

6 files changed

+28
-22
lines changed

6 files changed

+28
-22
lines changed

.github/workflows/test.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,21 +83,21 @@ jobs:
8383
uses: ./.github/actions/setup-nix
8484
with:
8585
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
86-
tools: tests.testSpec.bin tests.testIO.bin tests.testBigSchema.bin withTools.postgresql-${{ matrix.pgVersion }}.bin cabalTools.update.bin
86+
tools: tests.testSpec.bin tests.testIO.bin tests.testBigSchema.bin withTools.pg-${{ matrix.pgVersion }}.bin cabalTools.update.bin
8787

8888
- run: postgrest-cabal-update
8989

9090
- name: Run spec tests
9191
if: always()
92-
run: postgrest-with-postgresql-${{ matrix.pgVersion }} postgrest-test-spec
92+
run: postgrest-with-pg-${{ matrix.pgVersion }} postgrest-test-spec
9393

9494
- name: Run IO tests
9595
if: always()
96-
run: postgrest-with-postgresql-${{ matrix.pgVersion }} postgrest-test-io -vv
96+
run: postgrest-with-pg-${{ matrix.pgVersion }} postgrest-test-io -vv
9797

9898
- name: Run IO tests on a big schema
9999
if: always()
100-
run: postgrest-with-postgresql-${{ matrix.pgVersion }} postgrest-test-big-schema -vv
100+
run: postgrest-with-pg-${{ matrix.pgVersion }} postgrest-test-big-schema -vv
101101

102102

103103
memory:

default.nix

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ let
5353

5454
postgresqlVersions =
5555
[
56-
{ name = "postgresql-17"; postgresql = pkgs.postgresql_17.withPackages (p: [ p.postgis p.pg_safeupdate ]); }
57-
{ name = "postgresql-16"; postgresql = pkgs.postgresql_16.withPackages (p: [ p.postgis p.pg_safeupdate ]); }
58-
{ name = "postgresql-15"; postgresql = pkgs.postgresql_15.withPackages (p: [ p.postgis p.pg_safeupdate ]); }
59-
{ name = "postgresql-14"; postgresql = pkgs.postgresql_14.withPackages (p: [ p.postgis p.pg_safeupdate ]); }
60-
{ name = "postgresql-13"; postgresql = pkgs.postgresql_13.withPackages (p: [ p.postgis p.pg_safeupdate ]); }
56+
{ name = "pg-17"; postgresql = pkgs.postgresql_17.withPackages (p: [ p.postgis p.pg_safeupdate ]); }
57+
{ name = "pg-16"; postgresql = pkgs.postgresql_16.withPackages (p: [ p.postgis p.pg_safeupdate ]); }
58+
{ name = "pg-15"; postgresql = pkgs.postgresql_15.withPackages (p: [ p.postgis p.pg_safeupdate ]); }
59+
{ name = "pg-14"; postgresql = pkgs.postgresql_14.withPackages (p: [ p.postgis p.pg_safeupdate ]); }
60+
{ name = "pg-13"; postgresql = pkgs.postgresql_13.withPackages (p: [ p.postgis p.pg_safeupdate ]); }
6161
];
6262

6363
haskellPackages = pkgs.haskell.packages."${compiler}";

nix/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,11 @@ postgrest-gen-ctags postgrest-watch
9191
postgrest-gen-jwt postgrest-with-all
9292
postgrest-gen-secret postgrest-with-git
9393
postgrest-git-hooks postgrest-with-pgrst
94-
postgrest-hsie-graph-modules postgrest-with-postgresql-13
95-
postgrest-hsie-graph-symbols postgrest-with-postgresql-14
96-
postgrest-hsie-minimal-imports postgrest-with-postgresql-15
97-
postgrest-lint postgrest-with-postgresql-16
98-
postgrest-loadtest postgrest-with-postgresql-17
94+
postgrest-hsie-graph-modules postgrest-with-pg-13
95+
postgrest-hsie-graph-symbols postgrest-with-pg-14
96+
postgrest-hsie-minimal-imports postgrest-with-pg-15
97+
postgrest-lint postgrest-with-pg-16
98+
postgrest-loadtest postgrest-with-pg-17
9999
postgrest-loadtest-against postgrest-with-slow-pg
100100
postgrest-loadtest-report postgrest-with-slow-postgrest
101101
postgrest-nixpkgs-upgrade
@@ -174,7 +174,7 @@ $ nix-shell --run "postgrest-with-all postgrest-test-spec"
174174

175175
# Run the tests against a specific version of PostgreSQL (use tab-completion in
176176
# nix-shell to see all available versions):
177-
$ nix-shell --run "postgrest-with-postgresql-13 postgrest-test-spec"
177+
$ nix-shell --run "postgrest-with-pg-13 postgrest-test-spec"
178178

179179
```
180180

@@ -284,7 +284,7 @@ Tools like `postgrest-build`, `postgrest-run`, `postgrest-repl` etc. are simple
284284
also run in CI, with the exception of the IO and Memory checks that need to be run
285285
separately.
286286

287-
`postgrest-with-postgresql-*` take a command as an argument and will run it
287+
`postgrest-with-pg-*` take a command as an argument and will run it
288288
with a temporary database. `postgrest-with-all` will run the command against
289289
all supported PostgreSQL versions. Tests run without `postgrest-with-*` are
290290
run against the latest PostgreSQL version by default.

nix/tools/withTools.nix

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ let
4646
}
4747
4848
# Avoid starting multiple layers of withTmpDb, but make sure to have the last invocation
49-
# load fixtures. Otherwise postgrest-with-postgresql-xx postgrest-test-io would not be possible.
49+
# load fixtures. Otherwise postgrest-with-pg-xx postgrest-test-io would not be possible.
5050
if ! test -v PGHOST; then
5151
5252
mkdir -p "$tmpdir"/{db,socket}
@@ -74,7 +74,13 @@ let
7474
>> "$setuplog"
7575
7676
log "Starting the database cluster..."
77+
7778
# Instead of listening on a local port, we will listen on a unix domain socket.
79+
# NOTE: unix domain socket filename name must remain under max limit.
80+
# On Linux, it's 108 chars (including '\0' terminator)
81+
# On MacOS, it's 104 chars
82+
# See: https://serverfault.com/questions/641347/check-if-a-path-exceeds-maximum-for-unix-domain-socket
83+
7884
pg_ctl -l "$tmpdir/db.log" -w start -o "-F -c listen_addresses=\"\" -c hba_file=$HBA_FILE -k $PGHOST -c log_statement=\"all\" " \
7985
>> "$setuplog"
8086
@@ -87,7 +93,7 @@ let
8793
if test "$_arg_replica" = "on"; then
8894
replica_slot="replica_$RANDOM"
8995
replica_dir="$tmpdir/$replica_slot"
90-
replica_host="$tmpdir/socket_$replica_slot"
96+
replica_host="$tmpdir/sock_$replica_slot"
9197
9298
mkdir -p "$replica_host"
9399
@@ -433,7 +439,7 @@ buildToolbox
433439
withSlowPg
434440
withSlowPgrst;
435441
} // builtins.listToAttrs (
436-
# Create a `postgrest-with-postgresql-` for each PostgreSQL version
442+
# Create a `postgrest-with-pg-` for each PostgreSQL version
437443
builtins.map (pg: { inherit (pg) name; value = withTmpDb pg; }) postgresqlVersions
438444
);
439445
# make latest withPg available for other nix files

test/io/big_schema.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ We use it to test our metadata generation because it contains a good amount of d
55
66
Custom roles and privileges were removed.
77
8-
postgrest-with-postgresql-14 -f test/io/big_schema.sql psql
8+
postgrest-with-pg-14 -f test/io/big_schema.sql psql
99
1010
Has 12 functions:
1111

test/pgbench/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
Can be used as:
44

55
```
6-
postgrest-with-postgresql-15 -f test/pgbench/fixtures.sql pgbench -U postgres -n -T 10 -f test/pgbench/1567/old.sql
6+
postgrest-with-pg-15 -f test/pgbench/fixtures.sql pgbench -U postgres -n -T 10 -f test/pgbench/1567/old.sql
77
8-
postgrest-with-postgresql-15 -f test/pgbench/fixtures.sql pgbench -U postgres -n -T 10 -f test/pgbench/1567/new.sql
8+
postgrest-with-pg-15 -f test/pgbench/fixtures.sql pgbench -U postgres -n -T 10 -f test/pgbench/1567/new.sql
99
```
1010

1111
## Directory structure

0 commit comments

Comments
 (0)