nix: more explicit logging in load test
* Write vegeta output to file explicitly. The previous version using `tee` captured the standard output of the `withPgrst` helper, too, causing weird errors when those had unexpected output. * Log and fail the postgrest build explicitly. In situations such as changing nix dependencies, the `cabal build` run could fail, but this wasn't visible in CI. With these changes, the load test now fails with a nice error message when the build fails.
This commit is contained in:
@@ -60,9 +60,8 @@ let
|
||||
# shellcheck disable=SC2145
|
||||
${withTools.withPg} --fixtures "$_arg_testdir"/fixtures.sql \
|
||||
${withTools.withPgrst} \
|
||||
sh -c "cd \"$_arg_testdir\" && ${runner} -targets targets.http \"''${_arg_leftovers[@]}\"" \
|
||||
| tee "$_arg_output" \
|
||||
| ${vegeta}/bin/vegeta report -type=text
|
||||
sh -c "cd \"$_arg_testdir\" && ${runner} -targets targets.http -output \"$_arg_output\" \"''${_arg_leftovers[@]}\""
|
||||
${vegeta}/bin/vegeta report -type=text "$_arg_output"
|
||||
'';
|
||||
|
||||
loadtestAgainst =
|
||||
|
||||
+16
-2
@@ -244,7 +244,16 @@ let
|
||||
''
|
||||
export PGRST_SERVER_UNIX_SOCKET="$tmpdir"/postgrest.socket
|
||||
|
||||
${cabal-install}/bin/cabal v2-build ${devCabalOptions} > "$tmpdir"/build.log 2>&1
|
||||
echo -n "Building postgrest... "
|
||||
${cabal-install}/bin/cabal v2-build ${devCabalOptions} > "$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 &
|
||||
|
||||
@@ -256,7 +265,12 @@ let
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
timeout -s TERM 5 ${waitForPgrstReady}
|
||||
timeout -s TERM 5 ${waitForPgrstReady} || {
|
||||
echo "timed out, output:"
|
||||
cat "$tmpdir"/run.log
|
||||
exit 1
|
||||
}
|
||||
echo "done."
|
||||
|
||||
("$_arg_command" "''${_arg_leftovers[@]}")
|
||||
'';
|
||||
|
||||
Reference in New Issue
Block a user