aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2013-10-31 19:05:10 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2013-11-01 19:58:08 +0100
commit40eaf2303f013321b923c5bb616f0579a01a9884 (patch)
tree8f3166de44a8e9ef8afcc45d9d033eb14192c978
parentf743a82f560a2b1da4bc1b5f3236c4226fa6a9ab (diff)
downloadapp.sh-40eaf2303f013321b923c5bb616f0579a01a9884.tar.gz
app.sh-40eaf2303f013321b923c5bb616f0579a01a9884.tar.bz2
app.sh-40eaf2303f013321b923c5bb616f0579a01a9884.tar.xz
app.sh-40eaf2303f013321b923c5bb616f0579a01a9884.zip
o Adding some tests for app-operate.
-rwxr-xr-xlibexec/app-operator-pid2
-rwxr-xr-xtest/app-operate.bats31
2 files changed, 32 insertions, 1 deletions
diff --git a/libexec/app-operator-pid b/libexec/app-operator-pid
index a3781ee..c9b2096 100755
--- a/libexec/app-operator-pid
+++ b/libexec/app-operator-pid
@@ -94,7 +94,7 @@ command_start() {
esac
export APPSH_HOME
- echo "Starting app..."
+ debug "Starting app..."
$launcher <&- 1>&- 2>&- &
PID=$!
diff --git a/test/app-operate.bats b/test/app-operate.bats
new file mode 100755
index 0000000..e931f3c
--- /dev/null
+++ b/test/app-operate.bats
@@ -0,0 +1,31 @@
+#!/usr/bin/env bats
+# vim: set filetype=sh:
+
+load utils
+
+@test "app-upgrade" {
+ mkzip app-a
+
+ app init -d my-app file $APPSH_HOME/test/data/app-a.zip
+
+ cd my-app
+ app status
+ eq '${lines[0]}' "Not running"
+ eq '${#lines[*]}' 1
+
+ app start
+ pid=`cat .app/pid`
+ match '${lines[0]}' "Application launched as $pid"
+ eq '${#lines[*]}' 1
+
+ app stop
+ match '${lines[0]}' "Sending TERM to $pid, waiting for shutdown.*"
+ eq '${#lines[*]}' 1
+
+ echo wat > .app/pid
+ check_status=no
+ app stop
+ eq '$status' 1
+ match '${lines[0]}' "The application crashed. Was running as wat"
+ eq '${#lines[*]}' 1
+}