snowdriftcoop / snowdrift

Infrastructure for Snowdrift.coop. This is a MIRROR of https://gitlab.com/snowdrift/snowdrift. Your issue reports and merge requests are welcome, but they will be moved to gitlab.com. You are encouraged to start there instead!
https://snowdrift.coop
GNU Affero General Public License v3.0
92 stars 36 forks source link

./build.sh test failure on NixOS #337

Closed freeman42x closed 5 years ago

freeman42x commented 5 years ago
[neo@nixos:~/Forks/snowdrift]$ ./build.sh test
The files belonging to this database system will be owned by user "neo".
This user must also own the server process.

initdb: file "/run/current-system/sw/share/postgres.bki" does not exist
This might mean you have a corrupted installation or identified
the wrong directory with the invocation option -L.
pg_ctl: database system initialization failed
make: *** [db.makefile:35: /home/neo/Forks/snowdrift/.postgres-work/PG_VERSION] Error 1
chreekat commented 5 years ago

Interesting! This looks like it might be a bug in how postgres is packaged in NixOS. Can you post the output of bash -x build.sh test?

freeman42x commented 5 years ago

@chreekat

[nix-shell:~/Forks/snowdrift]$ bash -x build.sh test
+ set -e
+ usage='
.
.  build.sh CMD [OPTIONS]
.

  Used to run tests and run the devel site.

  Uses Make to ensure the dev database is running. Consult db.makefile for more
  DB control options.

  CMD can be:

      devel    -- Assumed if no CMD is given. Launches development site.
      test     -- Runs Stack tests. Does not launch site.

      cleandb  -- Blow away the database.

  '\''test'\'' accepts any additional options native to '\''stack test'\''

'
+++ dirname build.sh
++ cd .
++ git rev-parse --show-toplevel
+ projRoot=/home/neo/Forks/snowdrift
+ export PGDATA=/home/neo/Forks/snowdrift/.postgres-work
+ PGDATA=/home/neo/Forks/snowdrift/.postgres-work
+ export PGHOST=/home/neo/Forks/snowdrift/.postgres-work
+ PGHOST=/home/neo/Forks/snowdrift/.postgres-work
+ export PGDATABASE=snowdrift_development
+ PGDATABASE=snowdrift_development
+ dbmake=(stack exec -- make -s -C "$projRoot" -f db.makefile)
+ main test
+ '[' -z test ']'
+ CMD=test
+ shift
+ '[' -e .stripe_keys ']'
+ case "$CMD" in
+ touch website/src/Settings/StaticFiles.hs
+ with_db snowdrift_test stack --work-dir .stack-test test
+ trap 'stack exec -- make -s -C /home/neo/Forks/snowdrift -f db.makefile stop' EXIT
+ PGDATABASE=snowdrift_test
+ stack exec -- make -s -C /home/neo/Forks/snowdrift -f db.makefile
The files belonging to this database system will be owned by user "neo".
This user must also own the server process.

initdb: file "/run/current-system/sw/share/postgres.bki" does not exist
This might mean you have a corrupted installation or identified
the wrong directory with the invocation option -L.
pg_ctl: database system initialization failed
make: *** [db.makefile:35: /home/neo/Forks/snowdrift/.postgres-work/PG_VERSION] Error 1
++ stack exec -- make -s -C /home/neo/Forks/snowdrift -f db.makefile stop
freeman42x commented 5 years ago

I got a fix for this. Will submit a PR.

freeman42x commented 5 years ago

Fix is here: https://github.com/snowdriftcoop/snowdrift/pull/338