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:
+13
-9
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user