aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/app-upgrade.bats40
-rw-r--r--test/utils.bash36
2 files changed, 66 insertions, 10 deletions
diff --git a/test/app-upgrade.bats b/test/app-upgrade.bats
new file mode 100755
index 0000000..2dde851
--- /dev/null
+++ b/test/app-upgrade.bats
@@ -0,0 +1,40 @@
+#!/usr/bin/env bats
+# vim: set filetype=sh:
+
+load utils
+
+@test "app-upgrade" {
+ mkzip app-a
+ install_artifact
+
+ app init -d my-app maven -r "$FIXED_REPO_URL" org.example:app-a:1.0-SNAPSHOT; echo_lines
+ eq '$status' 0
+
+ cd my-app
+ app conf get maven.version
+ match '${lines[0]}' "1.0-SNAPSHOT"
+ maven_version="${lines[0]}"
+ describe maven_version=$maven_version
+
+ app conf get app.version
+ match '${lines[0]}' "1.0-.*"
+ app_version="${lines[0]}"
+ describe app_version=$app_version
+
+ app conf get app.resolved_version
+ match '${lines[0]}' "1.0-.*"
+ eq '${lines[0]}' "$app_version"
+ resolved_version="${lines[0]}"
+ describe resolved_version=$resolved_version
+
+ install_artifact
+
+ app upgrade; echo_lines
+ eq '$status' 0
+
+ app conf get app.resolved_version
+ match '${lines[0]}' "1.0-.*"
+ new_resolved_version="${lines[0]}"
+ describe new_resolved_version=$new_resolved_version
+ neq $new_resolved_version $resolved_version
+}
diff --git a/test/utils.bash b/test/utils.bash
index cb2337b..ad80629 100644
--- a/test/utils.bash
+++ b/test/utils.bash
@@ -61,16 +61,16 @@ app_libexec() {
run "$x" $@
}
-fix_path=`uname -s`
+fix_path_uname=`uname -s`
fix_path() {
- local path=$1
-
- case $fix_path in
+ case $fix_path_uname in
CYGWIN_NT*)
- x=$(cygpath -wa $1)
+ cygpath -wa $1
+ ;;
+ *)
+ echo $1
;;
esac
- echo $x
}
describe() {
@@ -100,8 +100,8 @@ can_not_read() {
is_directory() {
if [ ! -d "$1" ]
then
- echo "Not a directory: $1" 2>&1
- return 1
+ echo "Not a directory: $1" 2>&1
+ return 1
fi
}
@@ -112,7 +112,7 @@ eq() {
if [[ $e == $a ]]
then
- return 0
+ return 0
fi
echo "Assertion failed: $ex"
@@ -121,6 +121,22 @@ eq() {
exit 1
}
+neq() {
+ local ex="$1"
+ local e="$2"
+ local a="`eval echo $ex`"
+
+ if [[ $e != $a ]]
+ then
+ return 0
+ fi
+
+ echo "Not-equal assertion failed: $ex"
+ echo "Expected: $e"
+ echo "Actual: $a"
+ exit 1
+}
+
match() {
local ex="$1"
local regex="$2"
@@ -128,7 +144,7 @@ match() {
if [[ $a =~ $regex ]]
then
- return 0
+ return 0
fi
echo "Assertion failed: $ex =~ $a"