Nixify io and memory tests (#1538)

* Include tests for io and memory in the Nix environment.
* include spec tests in nix-shell by default
* install the io and memory tests in CI
This commit is contained in:
Remo Rechkemmer
2020-05-28 12:45:14 -05:00
committed by GitHub
parent 784ebe57d7
commit 69b09e312a
18 changed files with 211 additions and 108 deletions
+13 -9
View File
@@ -1,4 +1,15 @@
#! /usr/bin/env bash
# This test script expects that a `postgrest` executable with profiling enabled
# is on the PATH. With stack, for example, you can run `stack install --profile
# postgrest`.
set -eu
export POSTGREST_TEST_CONNECTION=${POSTGREST_TEST_CONNECTION:-"postgres:///postgrest_test"}
trap "kill 0" int term exit
currentTest=1
failedTests=0
result(){ echo "$1 $currentTest $2"; currentTest=$(( $currentTest + 1 )); }
@@ -7,14 +18,9 @@ ko(){ result 'not ok' "- $1"; failedTests=$(( $failedTests + 1 )); }
pgrPort=49421
pgrStopAll(){ pkill -f "$(stack path --profile --local-install-root)/bin/postgrest"; }
pgrStart(){ stack exec --profile -- postgrest test/memory-tests/config +RTS -p -h >/dev/null & pgrPID="$!"; }
pgrStart(){ postgrest test/memory-tests/config +RTS -p -h > /dev/null & pgrPID="$!"; }
pgrStop(){ kill "$pgrPID" 2>/dev/null; }
setUp(){ pgrStopAll; }
cleanUp(){ pgrStopAll; }
checkPgrStarted(){
while pgrStarted && test $(rootStatus) -ne 200
do
@@ -90,8 +96,6 @@ postJsonArrayTest(){
fi
}
setUp
echo "Running memory usage tests.."
jsonKeyTest "1M" "POST" "/rpc/leak?columns=blob" "13M"
@@ -110,6 +114,6 @@ postJsonArrayTest "1000" "/perf_articles?columns=id,body" "11M"
postJsonArrayTest "10000" "/perf_articles?columns=id,body" "11M"
postJsonArrayTest "100000" "/perf_articles?columns=id,body" "21M"
cleanUp
trap - int term exit
exit $failedTests