aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2017-02-22 00:17:14 -0800
committerbnewbold <bnewbold@robocracy.org>2017-02-22 00:17:14 -0800
commit6afe59dc79e71b1aca1ba734b950af18ff503a0a (patch)
tree36dc8c2577ef960cc1b542dcd1ef1811d99b5609
parentae07e75655d2a0783a3b50b557768e7dc285f765 (diff)
downloadeinhyrningsins-6afe59dc79e71b1aca1ba734b950af18ff503a0a.tar.gz
einhyrningsins-6afe59dc79e71b1aca1ba734b950af18ff503a0a.zip
add a crude bash test file
-rwxr-xr-xtest.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/test.sh b/test.sh
new file mode 100755
index 0000000..55fa2c3
--- /dev/null
+++ b/test.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+set -e -u -o pipefail
+
+trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT
+
+EINSOCK="/tmp/einhyrningsins_tests.sock"
+EIN="target/debug/einhyrningsins --socket-path $EINSOCK"
+EINCTL="target/debug/einhyrningsinsctl --socket-path $EINSOCK"
+
+export RUST_BACKTRACE=1
+
+echo "### Run through ctl commands"
+rm -f $EINSOCK
+$EIN -- nc -l 127.0.0.1 9123 > /dev/null &
+sleep 0.5
+$EINCTL -e inc > /dev/null
+$EINCTL -e upgrade > /dev/null
+$EINCTL -e dec > /dev/null
+$EINCTL -e status > /dev/null
+$EINCTL -e help > /dev/null
+$EINCTL -e version > /dev/null
+$EINCTL -e die > /dev/null
+sleep 1
+jobs > /dev/null
+test -z "`jobs`"
+
+echo "### Graceful shutdown via ctl"
+rm -f $EINSOCK
+$EIN --bind localhost:9876 -- examples/einhorn_http.py > /dev/null &
+sleep 0.5
+$EINCTL -e die > /dev/null
+sleep 1
+jobs > /dev/null
+test -z "`jobs`"
+trap "trap - SIGTERM" SIGINT SIGTERM EXIT