test: consistently analyze tables exactly once

Disabling the autovacuum daemon should also help reproducibility in
theory, although I don't know of any cases where we hit a problem with
that.

VACUUM changes the order of rows that PostgreSQL returns for some table
without explicit ordering, thus doing the latter to make it consistently
reproducible.

After ANALYZE estimates are 100% exact for the moment, so some requests
which returned 206 Partial Response now return 200 instead. The fact
that PostgREST returns 206 on an unfiltered endpoint can probably be
considered a bug.
This commit is contained in:
Wolfgang Walther
2026-05-17 20:03:15 +00:00
parent abe3e511bf
commit c7260bddab
10 changed files with 33 additions and 34 deletions
+2
View File
@@ -15,6 +15,7 @@ let
let
commandName = "postgrest-with-${name}";
postgresqlConf = writeText "postgresql.conf" "
autovacuum = false
listen_addresses = ''
log_statement = all
";
@@ -143,6 +144,7 @@ let
load_start=$SECONDS
>&2 printf "${commandName}: Loading fixtures under the postgres role..."
psql -U postgres -v PGUSER="$PGUSER" -v ON_ERROR_STOP=1 -f "$_arg_fixtures" >> "$setuplog"
psql -U postgres -v ON_ERROR_STOP=1 -c "VACUUM ANALYZE;" >> "$setuplog"
load_end=$((SECONDS - load_start))
>&2 printf " done in %ss. Running command...\n" "$load_end"
fi