aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2013-10-20 21:55:01 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2013-10-20 22:01:26 +0200
commit989edff55111db3b457c9e04f3abf296e6ac555c (patch)
treeeb9bf0b99b7ed10a05c90a597d57e5c0e543c36d /test
parenta6ad0dd211ba4a394d70dd13d3375118b6e5f27a (diff)
downloadapp.sh-989edff55111db3b457c9e04f3abf296e6ac555c.tar.gz
app.sh-989edff55111db3b457c9e04f3abf296e6ac555c.tar.bz2
app.sh-989edff55111db3b457c9e04f3abf296e6ac555c.tar.xz
app.sh-989edff55111db3b457c9e04f3abf296e6ac555c.zip
o Getting "upgrade" to work with non-SNAPSHOT versions too.
o Removing maven.version. o Documenting(!) the different configuration keys and what they mean.
Diffstat (limited to 'test')
-rwxr-xr-xtest/app-init.bats18
-rwxr-xr-xtest/app-upgrade.bats27
-rw-r--r--test/utils.bash5
3 files changed, 33 insertions, 17 deletions
diff --git a/test/app-init.bats b/test/app-init.bats
index 3f58890..8ffe1b6 100755
--- a/test/app-init.bats
+++ b/test/app-init.bats
@@ -56,3 +56,21 @@ load utils
# Created by post-install
is_directory "my-app/logs"
}
+
+@test "Install 1.0-SNAPSHOT, upgrade to 1.0" {
+ mkzip app-a
+ install_artifact
+ app conf -l user set maven.repo "file://$BATS_TMPDIR/repo"
+ app init -d my-app maven org.example:app-a:1.0-SNAPSHOT
+
+ cd my-app
+ app conf set app.version 1.0
+
+ install_artifact 1.0
+ app upgrade
+ cd current
+ run pwd -P
+
+ match '${lines[0]}' ".*/versions/1.0/root$"
+ eq '${#lines[*]}' 1
+}
diff --git a/test/app-upgrade.bats b/test/app-upgrade.bats
index 5d79260..4eef351 100755
--- a/test/app-upgrade.bats
+++ b/test/app-upgrade.bats
@@ -7,35 +7,34 @@ load utils
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
+ app init -d my-app maven -r "$FIXED_REPO_URL" org.example:app-a:1.0-SNAPSHOT
cd my-app
- app conf get maven.version
- match '${lines[0]}' "1.0-SNAPSHOT"
- maven_version="${lines[0]}"
app conf get app.version
- match '${lines[0]}' "1.0-.*"
+ eq '${lines[0]}' "1.0-SNAPSHOT"
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
+
+ app conf get app.installed_version
+ match '${lines[0]}' "1.0-.*"
+ installed_version="${lines[0]}"
+ describe installed_version = $installed_version
- describe maven_version=$maven_version
- describe app_version=$app_version
- describe resolved_version=$resolved_version
+ eq '$installed_version' "$resolved_version"
install_artifact
- app upgrade; echo_lines
- eq '$status' 0
+ app upgrade
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
+ describe new_resolved_version = $new_resolved_version
+ neq $new_resolved_version $resolved_version
}
diff --git a/test/utils.bash b/test/utils.bash
index 88dd889..f767d90 100644
--- a/test/utils.bash
+++ b/test/utils.bash
@@ -172,8 +172,7 @@ match() {
return 0
fi
- echo "Assertion failed: $ex =~ $a"
- echo "Expected: $e"
- echo "Actual: $a"
+ echo "Match failed: $ex =~ $regex"
+ echo "Value: $a"
exit 1
}