aboutsummaryrefslogtreecommitdiff
path: root/test/app-upgrade.bats
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2013-11-01 16:24:26 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2013-11-01 19:58:08 +0100
commitba7820b18c0ee8631505f7a2a764f7222a732d44 (patch)
tree82bc1d530e1f815e8d8687fa642dd5c84a59c114 /test/app-upgrade.bats
parent93e2978fbe5582440d79c47b5975659d9cbf701b (diff)
downloadapp.sh-v0.2-dev.tar.gz
app.sh-v0.2-dev.tar.bz2
app.sh-v0.2-dev.tar.xz
app.sh-v0.2-dev.zip
bin/app-upgrade: Removing unreachable code. Fixing it so it comparesv0.2-dev
against the currently installed version instead of the last resolved version which makes it possible to retry installation of the same version. libexec/app-install-file: Allowing installation of the same file twice. Checks if the file has been unpacked earlier or not. Removes the unpacked version on failure.
Diffstat (limited to 'test/app-upgrade.bats')
-rwxr-xr-xtest/app-upgrade.bats30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/app-upgrade.bats b/test/app-upgrade.bats
index d27c6e7..9a282e3 100755
--- a/test/app-upgrade.bats
+++ b/test/app-upgrade.bats
@@ -38,3 +38,33 @@ load utils
describe new_resolved_version = $new_resolved_version
neq $new_resolved_version $resolved_version
}
+
+@test "app-upgrade - when pre-install fails the first run" {
+ mkzip app-a
+ file=$APPSH_HOME/test/data/app-a.zip
+ touch -t 01010101 $file
+
+ app init -d my-app file $file
+
+ cd my-app
+
+ # A new version is available, but make sure pre-install fails.
+ touch -t 02020202 $file
+ touch fail-pre-install
+ check_status=no
+ app upgrade
+ eq '${status}' 1
+
+ # Try to reinstall the same file
+ rm fail-pre-install
+ app upgrade
+ eq '${lines[0]}' "Resolving version "
+ eq '${lines[1]}' "Resolved version to 1359766920"
+ eq '${lines[2]}' "Version 1359766920 is already unpacked"
+ eq '${lines[3]}' "Importing config from versions/1359766920/app.config"
+ eq '${lines[4]}' "pre-install"
+ eq '${lines[5]}' "Changing current symlink from 1356998460 to 1359766920"
+ eq '${lines[6]}' "post-install"
+
+ eq '${#lines[*]}' 7
+}