From 725fdc75ce0c863ece615047c8a53ce5283f8eeb Mon Sep 17 00:00:00 2001 From: Sebastian Wick Date: Thu, 4 Dec 2025 17:20:53 +0100 Subject: [PATCH] tests/test-preinstall.sh: Add test for sideloading with network failure If there is a sideload repo we should be able to pick it up when there are non-sideload repos which cannot be reached. --- tests/test-preinstall.sh | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/tests/test-preinstall.sh b/tests/test-preinstall.sh index f3db996b..00230c81 100755 --- a/tests/test-preinstall.sh +++ b/tests/test-preinstall.sh @@ -82,7 +82,7 @@ setup_repo test2 make_updated_app test2 org.test.Collection.test2 master HELLO2_MASTER_C2 org.test.Hello2 make_updated_app test2 org.test.Collection.test2 master HELLO2_MASTER_C3 org.test.Hello3 -echo "1..11" +echo "1..12" # just checking that the test remote got added port=$(cat httpd-port) @@ -266,4 +266,28 @@ ${FLATPAK} ${U} preinstall -y >&2 ${FLATPAK} ${U} list --columns=ref > list-log assert_file_has_content list-log "^org\.test\.Hello3/.*/master$" -ok "app not in first repo" \ No newline at end of file +ok "app not in first repo" + +# create sideload repo +${FLATPAK} ${U} install -y test-repo org.test.Hello//master >&2 +mkdir usb_dir +${FLATPAK} ${U} create-usb --destination-repo=repo usb_dir org.test.Hello//master >&2 +SIDELOAD_REPO=$(realpath usb_dir/repo) +${FLATPAK} ${U} uninstall -y --all >&2 + +# make sure nothing is installed +${FLATPAK} ${U} list --columns=ref > list-log +assert_file_empty list-log +! ostree config --repo=$XDG_DATA_HOME/flatpak/repo get --group "core" xa.preinstalled &> /dev/null + +# The preinstall config wants org.test.Hello. +cp hello-install.preinstall $FLATPAK_DATA_DIR/preinstall.d/ + +# simulate broken network +${FLATPAK} ${U} remote-modify --url="http://no.127.0.0.1:${port}/test" test-repo >&2 +${FLATPAK} ${U} remote-modify --url="http://no.127.0.0.1:${port}/test" test2-repo >&2 + +# ensure that installation from the sideload repo works +${FLATPAK} ${U} -vvvv preinstall -y --sideload-repo=${SIDELOAD_REPO} >&2 + +ok "sideload with network failure" \ No newline at end of file