summaryrefslogtreecommitdiff
path: root/tests/test-repo.sh
diff options
context:
space:
mode:
authorMatthew Leeds <matthew.leeds@endlessm.com>2019-11-18 13:16:44 -0800
committerAlexander Larsson <alexander.larsson@gmail.com>2019-11-20 13:17:27 +0100
commiteabc52456a7915c4900e3e39fdded1309969d017 (patch)
treef6d14b7fabf00821efdd416cacbee5143dec8292 /tests/test-repo.sh
parent13366524d82af14ad35fa4618ccf202ece1adacc (diff)
downloadflatpak-eabc52456a7915c4900e3e39fdded1309969d017.tar.gz
Clean up duplicated mirror refs
Due to bug #3215 some systems have refs in refs/mirrors/ in addition to the usual refs/remotes/ location. The remote refs are always at least as new as the mirror ones since the repo_pull() invocation in flatpak_dir_pull() which does not use OSTREE_PULL_FLAGS_MIRROR happened after the one that did. Cleaning up these mirror refs is important since otherwise when the remote ref is either updated or removed (by an uninstall) disk space will be leaked since the mirror ref will point to a no longer needed commit. So, remove (almost) all mirror refs during flatpak repair, uninstall, or update operations. And for the uninstall and update operations do it in FlatpakDir so that it happens regardless of if the CLI of libflatpak are used. Also, add a unit test for this. Fixes https://github.com/flatpak/flatpak/issues/3222
Diffstat (limited to 'tests/test-repo.sh')
-rw-r--r--tests/test-repo.sh12
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/test-repo.sh b/tests/test-repo.sh
index 96535ffe..fd4b9337 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..36"
+echo "1..37"
#Regular repo
setup_repo
@@ -445,6 +445,16 @@ assert_file_has_content $FL_DIR/app/org.test.Hello/$ARCH/master/active/files/bin
echo "ok redirect url and gpg key"
+# Test https://github.com/flatpak/flatpak/issues/3222
+mkdir -p $FL_DIR/repo/refs/mirrors/org.test.Collection.test/app/org.test.Hello/$ARCH/
+cp $FL_DIR/repo/refs/remotes/test-repo/app/org.test.Hello/$ARCH/master $FL_DIR/repo/refs/mirrors/org.test.Collection.test/app/org.test.Hello/$ARCH/
+make_updated_app test-gpg3 org.test.Collection.test master UPDATE2
+${FLATPAK} ${U} update -y org.test.Hello
+assert_not_has_file $FL_DIR/repo/refs/mirrors/org.test.Collection.test/app/org.test.Hello/$ARCH/master
+assert_has_file $FL_DIR/repo/refs/remotes/test-repo/app/org.test.Hello/$ARCH/master
+
+echo "ok mirror ref deletion on update"
+
${FLATPAK} ${U} list --arch=$ARCH --columns=ref > list-log
assert_file_has_content list-log "org\.test\.Hello"
assert_file_has_content list-log "org\.test\.Platform"