summaryrefslogtreecommitdiff
path: root/tests/test-repo.sh
diff options
context:
space:
mode:
authorPhaedrus Leeds <matthew.leeds@endlessm.com>2020-08-24 07:49:26 -0700
committerAlexander Larsson <alexander.larsson@gmail.com>2020-10-08 09:14:51 +0200
commit7691fc77eb0d47eaeb6d62217447f68af5bd425d (patch)
tree8c7955ffe487cf360081a7f9597d1811568f2611 /tests/test-repo.sh
parent617f614d50958c8d8355efc540ec5cb75d0b357b (diff)
downloadflatpak-7691fc77eb0d47eaeb6d62217447f68af5bd425d.tar.gz
app: Remove EOL unused runtimes in update command
In case a runtime becomes unused and then later becomes End-Of-Life, it is currently not removed. So this commit removes such runtimes in the update command, as discussed in #2639. A unit test is included. I am planning to propose to use the FlatpakTransaction API added here in gnome-software, so that users don't have to use the CLI at all for runtimes to be cleaned up. KDE Discover already removes unused runtimes periodically.
Diffstat (limited to 'tests/test-repo.sh')
-rw-r--r--tests/test-repo.sh23
1 files changed, 22 insertions, 1 deletions
diff --git a/tests/test-repo.sh b/tests/test-repo.sh
index 86647005..e0eb56a1 100644
--- a/tests/test-repo.sh
+++ b/tests/test-repo.sh
@@ -24,7 +24,7 @@ set -euo pipefail
skip_without_bwrap
skip_revokefs_without_fuse
-echo "1..40"
+echo "1..41"
#Regular repo
setup_repo
@@ -470,6 +470,27 @@ update_repo
ok "eol runtime uninstalled on app update to different runtime"
+${FLATPAK} ${U} install -y test-repo org.test.Hello
+
+# Runtime isn't EOL at time of app uninstall, so it's left alone
+${FLATPAK} ${U} uninstall -y org.test.Hello
+assert_has_dir $FL_DIR/runtime/org.test.Platform/$ARCH/master/active/files
+
+EXPORT_ARGS="--end-of-life=Reason4" make_updated_runtime
+${FLATPAK} ${U} update -y org.test.Platform
+${FLATPAK} ${U} info org.test.Platform > info-log
+assert_file_has_content info-log "End-of-life: Reason4"
+
+# Now that the runtime is EOL and unused it should be uninstalled by the update command
+${FLATPAK} ${U} update -y
+assert_not_has_dir $FL_DIR/runtime/org.test.Platform/$ARCH/master/active/files
+
+# Revert things for future tests
+EXPORT_ARGS="" make_updated_runtime
+${FLATPAK} ${U} uninstall -y --all
+
+ok "eol runtime uninstalled during update run"
+
${FLATPAK} ${U} install -y test-repo org.test.Platform
port=$(cat httpd-port)