summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2012-10-14 09:08:56 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2012-10-14 09:08:56 +0200
commita3db63fa62abee81e866fc2397c9302486a09cbb (patch)
treeba279b6184a5dca3a3aa4920e6d191f034ccd624
parente9a22d5165c2dda5a0e10506977081222549a8eb (diff)
downloadapp.sh-a3db63fa62abee81e866fc2397c9302486a09cbb.tar.gz
app.sh-a3db63fa62abee81e866fc2397c9302486a09cbb.tar.bz2
app.sh-a3db63fa62abee81e866fc2397c9302486a09cbb.tar.xz
app.sh-a3db63fa62abee81e866fc2397c9302486a09cbb.zip
o More tests.
-rw-r--r--.app/lib/app-app1
-rwxr-xr-xtest/app-help.bats (renamed from test/02-app-help.bats)4
-rwxr-xr-xtest/app-install.bats22
-rw-r--r--test/data/app-a.zipbin0 -> 715 bytes
-rw-r--r--test/data/app-a/root/bin/app-a0
-rw-r--r--test/data/app-a/scripts/postinstall3
-rwxr-xr-xtest/help.bats (renamed from test/01-help.bats)2
-rw-r--r--test/utils.bash8
8 files changed, 36 insertions, 4 deletions
diff --git a/.app/lib/app-app b/.app/lib/app-app
index 130244e..ae77298 100644
--- a/.app/lib/app-app
+++ b/.app/lib/app-app
@@ -354,7 +354,6 @@ method_list_versions_usage() {
fi
echo "usage: list-versions -n name -i instance [-P]" >&2
- echo " -P - parsable output" >&2
exit 1
}
diff --git a/test/02-app-help.bats b/test/app-help.bats
index 460762f..68f88e3 100755
--- a/test/02-app-help.bats
+++ b/test/app-help.bats
@@ -1,5 +1,5 @@
#!/usr/bin/env bats
-# vim: set filetype=sh :
+# vim: set filetype=sh:
load utils
@@ -27,7 +27,7 @@ load utils
app app list-versions; echo_lines
[ $status -eq $exit_usage ]
[ $(expr "${lines[0]}" : "usage: list-versions .*") -ne 0 ]
- [ ${#lines[*]} == 2 ]
+ [ ${#lines[*]} == 1 ]
}
@test "./app app set-current" {
diff --git a/test/app-install.bats b/test/app-install.bats
new file mode 100755
index 0000000..8f164bc
--- /dev/null
+++ b/test/app-install.bats
@@ -0,0 +1,22 @@
+#!/usr/bin/env bats
+# vim: set filetype=sh:
+
+load utils
+
+@test "./app app install" {
+ zip_app_a
+ app app install \
+ -r file \
+ -u $BATS_TEST_DIRNAME/data/app-a.zip \
+ -n app-a -i prod
+
+ echo_lines
+ [ $status -eq $exit_usage ]
+ [ "$output" = "Creating instance 'prod' for 'app-a'
+Unpacking...
+Running postinstall...
+Hello World!
+Postinstall completed successfully
+Changing current symlink" ]
+ [ ${#lines[*]} == 6 ]
+}
diff --git a/test/data/app-a.zip b/test/data/app-a.zip
new file mode 100644
index 0000000..7562ab6
--- /dev/null
+++ b/test/data/app-a.zip
Binary files differ
diff --git a/test/data/app-a/root/bin/app-a b/test/data/app-a/root/bin/app-a
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/data/app-a/root/bin/app-a
diff --git a/test/data/app-a/scripts/postinstall b/test/data/app-a/scripts/postinstall
new file mode 100644
index 0000000..cd16289
--- /dev/null
+++ b/test/data/app-a/scripts/postinstall
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+echo "Hello World!"
diff --git a/test/01-help.bats b/test/help.bats
index 8bd4fd7..eba4eeb 100755
--- a/test/01-help.bats
+++ b/test/help.bats
@@ -1,5 +1,5 @@
#!/usr/bin/env bats
-# vim: set filetype=sh :
+# vim: set filetype=sh:
load utils
diff --git a/test/utils.bash b/test/utils.bash
index eacabe8..eaa2580 100644
--- a/test/utils.bash
+++ b/test/utils.bash
@@ -19,6 +19,14 @@ setup() {
ln -s $APPSH
}
+zip_app_a() {
+(
+ cd $BATS_TEST_DIRNAME/data/app-a
+ rm -f ../app-a.zip
+ zip -qr ../app-a.zip *
+)
+}
+
app() {
run ./app "$@"
}