summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2016-05-17 10:32:29 +0200
committerAlexander Larsson <alexl@redhat.com>2016-05-17 10:32:29 +0200
commitc432c417c241abc2f6ec45f3e504a37ec913f36a (patch)
tree71ec39fa33b463cd2191d16e5813bbb03fee44e7
parent3b291090c78896b9892b0f38afa9e00d2602c6c3 (diff)
downloadxdg-app-c432c417c241abc2f6ec45f3e504a37ec913f36a.tar.gz
tests: Add test for update
-rw-r--r--tests/libtest.sh4
-rwxr-xr-xtests/make-test-app.sh4
-rwxr-xr-xtests/test-run.sh22
3 files changed, 28 insertions, 2 deletions
diff --git a/tests/libtest.sh b/tests/libtest.sh
index 0717af2..74ef142 100644
--- a/tests/libtest.sh
+++ b/tests/libtest.sh
@@ -149,6 +149,10 @@ setup_repo () {
flatpak remote-add --user --no-gpg-verify test-repo repo
}
+make_updated_app () {
+ . $(dirname $0)/make-test-app.sh UPDATED > /dev/null
+}
+
setup_sdk_repo () {
. $(dirname $0)/make-test-runtime.sh org.test.Sdk bash ls cat echo readlink make mkdir cp touch > /dev/null
}
diff --git a/tests/make-test-app.sh b/tests/make-test-app.sh
index e0f927e..92d4012 100755
--- a/tests/make-test-app.sh
+++ b/tests/make-test-app.sh
@@ -4,13 +4,15 @@ set -e
DIR=`mktemp -d`
+EXTRA="${1-}"
+
# Init dir
flatpak build-init ${DIR} org.test.Hello org.test.Platform org.test.Platform
mkdir -p ${DIR}/files/bin
cat > ${DIR}/files/bin/hello.sh <<EOF
#!/bin/sh
-echo "Hello world, from a sandbox"
+echo "Hello world, from a sandbox$EXTRA"
EOF
chmod a+x ${DIR}/files/bin/hello.sh
diff --git a/tests/test-run.sh b/tests/test-run.sh
index c10912a..6a62dd7 100755
--- a/tests/test-run.sh
+++ b/tests/test-run.sh
@@ -21,7 +21,7 @@ set -euo pipefail
. $(dirname $0)/libtest.sh
-echo "1..5"
+echo "1..6"
setup_repo
install_repo
@@ -101,3 +101,23 @@ if run_sh cat $(dirname $0)/package_version.txt &> /dev/null; then
fi
echo "ok overrides"
+
+
+OLD_COMMIT=`${FLATPAK} --user info --show-commit org.test.Hello`
+${FLATPAK} --user update org.test.Hello
+ALSO_OLD_COMMIT=`${FLATPAK} --user info --show-commit org.test.Hello`
+
+assert_streq "$OLD_COMMIT" "$ALSO_OLD_COMMIT"
+
+make_updated_app
+
+${FLATPAK} --user update org.test.Hello
+
+NEW_COMMIT=`${FLATPAK} --user info --show-commit org.test.Hello`
+
+assert_not_streq "$OLD_COMMIT" "$NEW_COMMIT"
+
+run org.test.Hello > hello_out
+assert_file_has_content hello_out '^Hello world, from a sandboxUPDATED$'
+
+echo "ok update"