Skip to content

Commit

Permalink
nix: build postgrest with nix in loadtest (fixes #2308)
Browse files Browse the repository at this point in the history
This allows running the load test against main even if the
dependencies change.
  • Loading branch information
robx committed Jun 14, 2022
1 parent 36ed7e2 commit 0c5d2e5
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions nix/tools/withTools.nix
Original file line number Diff line number Diff line change
Expand Up @@ -244,22 +244,18 @@ let
''
export PGRST_SERVER_UNIX_SOCKET="$tmpdir"/postgrest.socket
rm -f result
echo -n "Building postgrest... "
${cabal-install}/bin/cabal v2-build ${devCabalOptions} > "$tmpdir"/build.log 2>&1 \
|| {
nix-build -A postgrestPackage > "$tmpdir"/build.log 2>&1 || {
echo "failed, output:"
cat "$tmpdir"/build.log
exit 1
}
echo "done."
echo -n "Starting postgrest... "
${cabal-install}/bin/cabal v2-run ${devCabalOptions} --verbose=0 -- \
postgrest ${legacyConfig} > "$tmpdir"/run.log 2>&1 &
# to get the pid of the postgrest process, we need to jump through some hoops
# $! will return the pid of cabal - but killing this, will not propagate to postgrest
pid=$(timeout -s TERM 1 ${waitForPgrstPid})
./result/bin/postgrest ${legacyConfig} > "$tmpdir"/run.log 2>&1 &
pid=$!
cleanup() {
kill "$pid" || true
}
Expand Down

0 comments on commit 0c5d2e5

Please sign in to comment.