Skip to content
Snippets Groups Projects
Commit 2063866c authored by Lukas Braun's avatar Lukas Braun
Browse files

Fixes for building with pbuilder

Also make sure tests don't fail if a goatherd instance is running on the
build host.
parent 7999230d
No related branches found
Tags v0.3
No related merge requests found
...@@ -10,7 +10,7 @@ export PGHOST="$PWD/pg_pam_test" ...@@ -10,7 +10,7 @@ export PGHOST="$PWD/pg_pam_test"
cleanup() { cleanup() {
start_pg_cleanup start_pg_cleanup
pkill goatherd pkill -u $USER goatherd
} }
trap 'cleanup' EXIT INT trap 'cleanup' EXIT INT
...@@ -35,12 +35,15 @@ for i in $(seq 1 3); do ...@@ -35,12 +35,15 @@ for i in $(seq 1 3); do
ghdb $i init-db ghdb $i init-db
done done
servicedir=$PWD/test_pam_goatherd_services
mkdir -p $servicedir
echo echo
echo ===== Tests ===== echo ===== Tests =====
echo == Single server tests == echo == Single server tests ==
echo auth requisite $PWD/pam_goatherd.so certs=test.crt server=localhost:9999 >$PWD/test_pam_goatherd_services/single_server echo auth requisite $PWD/pam_goatherd.so certs=test.crt server=localhost:9989 >$servicedir/single_server
echo blub | if pw pamtester single_server someuser authenticate; then echo blub | if pw pamtester single_server someuser authenticate; then
die "FAIL: Auth succeeded but no server is running" die "FAIL: Auth succeeded but no server is running"
...@@ -48,7 +51,7 @@ else ...@@ -48,7 +51,7 @@ else
echo "(failure expected)" echo "(failure expected)"
fi fi
ghdb 1 serve -addr 127.0.0.1:9999 -tls-key test.key -tls-cert test.crt & ghdb 1 serve -addr 127.0.0.1:9989 -tls-key test.key -tls-cert test.crt &
echo blub | if pw pamtester single_server someuser authenticate; then echo blub | if pw pamtester single_server someuser authenticate; then
die "FAIL: Auth succeeded but user is not valid" die "FAIL: Auth succeeded but user is not valid"
...@@ -74,7 +77,7 @@ fi ...@@ -74,7 +77,7 @@ fi
echo echo
echo "== Multi server tests ==" echo "== Multi server tests =="
echo auth requisite $PWD/pam_goatherd.so certs=test.crt server=localhost:9999 server=localhost:9998 server=localhost:9997 >$PWD/test_pam_goatherd_services/three_servers echo auth requisite $PWD/pam_goatherd.so certs=test.crt server=localhost:9989 server=localhost:9988 server=localhost:9987 >$servicedir/three_servers
oathtool -d 8 -c 2 $(echo -n $secret | xxd -p) | \ oathtool -d 8 -c 2 $(echo -n $secret | xxd -p) | \
if pw pamtester three_servers someuser authenticate; then if pw pamtester three_servers someuser authenticate; then
...@@ -83,7 +86,7 @@ else ...@@ -83,7 +86,7 @@ else
echo "(failure expected)" echo "(failure expected)"
fi fi
ghdb 2 serve -addr 127.0.0.1:9998 -tls-key test.key -tls-cert test.crt & ghdb 2 serve -addr 127.0.0.1:9988 -tls-key test.key -tls-cert test.crt &
oathtool -d 8 -c 2 $(echo -n $secret | xxd -p) | \ oathtool -d 8 -c 2 $(echo -n $secret | xxd -p) | \
if pw pamtester three_servers someuser authenticate; then if pw pamtester three_servers someuser authenticate; then
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
set -eu set -eu
go test -c & go test -c -o ./goatherd.test &
PGHOST="$PWD/postgres_test" PGHOST="$PWD/postgres_test"
if [ $# -ge 1 ]; then if [ $# -ge 1 ]; then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment