summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen W. Taylor <otaylor@fishsoup.net>2018-08-12 21:33:26 +0200
committerAlexander Larsson <alexander.larsson@gmail.com>2018-08-13 11:23:28 +0200
commit90be1f7515b870b509c55ca6771a1e6521a678f7 (patch)
tree1db09d39d89771aac2f9bb1a0ac3f741090bffca
parent09d0e83c432357ad83eccab9cf255148dfe7b44d (diff)
downloadflatpak-90be1f7515b870b509c55ca6771a1e6521a678f7.tar.gz
test-oci-registry.sh: extend
Add: * Testing of flatpakrefs and bundles pointing to OCI remotes * Changing a remote from OCI to non-OCI, including during bundle installation. * Pruning origin remotes.
-rwxr-xr-xtests/test-oci-registry.sh93
1 files changed, 91 insertions, 2 deletions
diff --git a/tests/test-oci-registry.sh b/tests/test-oci-registry.sh
index 61dd4f78..cda93967 100755
--- a/tests/test-oci-registry.sh
+++ b/tests/test-oci-registry.sh
@@ -23,7 +23,7 @@ set -euo pipefail
skip_without_bwrap
-echo "1..7"
+echo "1..13"
# Start the fake registry server
@@ -112,7 +112,7 @@ assert_not_has_file $icondir/64x64
echo "ok appstream change"
-# Delete the remote, check that everything was removed
+# Change the remote to a non-OCI remote, check that we cleaned up
if [ x${USE_SYSTEMDIR-} == xyes ] ; then
base=$SYSTEMDIR
@@ -123,6 +123,23 @@ fi
assert_has_file $base/oci/oci-registry.index.gz
assert_has_file $base/oci/oci-registry.summary
assert_has_dir $base/appstream/oci-registry
+flatpak remote-modify ${U} --url=http://127.0.0.1:${port} oci-registry
+assert_not_has_file $base/oci/oci-registry.index.gz
+assert_not_has_file $base/oci/oci-registry.summary
+assert_not_has_dir $base/appstream/oci-registry
+
+echo "ok change remote to non-OCI"
+
+# Change it back and refetch
+
+flatpak remote-modify ${U} --url=oci+http://127.0.0.1:${port} oci-registry
+flatpak update ${U} --appstream oci-registry
+
+# Delete the remote, check that everything was removed
+
+assert_has_file $base/oci/oci-registry.index.gz
+assert_has_file $base/oci/oci-registry.summary
+assert_has_dir $base/appstream/oci-registry
flatpak ${U} -y uninstall org.test.Platform
flatpak ${U} remote-delete oci-registry
assert_not_has_file $base/oci/oci-registry.index.gz
@@ -130,3 +147,75 @@ assert_not_has_file $base/oci/oci-registry.summary
assert_not_has_dir $base/appstream/oci-registry
echo "ok delete remote"
+
+# Try installing the platform via a flatpakref file.
+
+cat << EOF > org.test.Platform.flatpakref
+[Flatpak Ref]
+Title=Test Platform
+Name=org.test.Platform
+Branch=master
+Url=oci+http://127.0.0.1:${port}
+IsRuntime=true
+EOF
+
+${FLATPAK} ${U} install -y --from ./org.test.Platform.flatpakref
+
+flatpak remotes > remotes-list
+assert_file_has_content remotes-list '^org.test.Platform-origin'
+
+assert_has_file $base/oci/org.test.Platform-origin.index.gz
+
+echo "ok install via flatpakref"
+
+# Uninstall, check that the origin remote was pruned, and files were
+# cleaned up properly
+
+flatpak ${U} -y uninstall org.test.Platform
+
+flatpak remotes > remotes-list
+assert_not_file_has_content remotes '^org.test.Platform-origin'
+
+assert_not_has_file $base/oci/org.test.Platform-origin.index.gz
+
+echo "ok prune origin remote"
+
+# Install from a (non-OCI) bundle, check that the repo-url is respected
+
+${FLATPAK} build-bundle --runtime --repo-url "oci+http://127.0.0.1:${port}" $FL_GPGARGS repos/oci org.test.Platform.flatpak org.test.Platform
+
+${FLATPAK} ${U} install -y --bundle org.test.Platform.flatpak
+
+flatpak remotes -d > remotes-list
+assert_file_has_content remotes-list "^org.test.Platform-origin.*[ ]oci+http://127.0.0.1:${port}"
+
+assert_has_file $base/oci/org.test.Platform-origin.index.gz
+
+echo "ok install via bundle"
+
+# Install an app from a bundle
+
+${FLATPAK} build-bundle --repo-url "oci+http://127.0.0.1:${port}" $FL_GPGARGS repos/oci org.test.Hello.flatpak org.test.Hello
+
+${FLATPAK} ${U} install -y --bundle org.test.Hello.flatpak
+
+flatpak remotes -d > remotes-list
+assert_file_has_content remotes-list "^org.test.Hello-origin.*[ ]oci+http://127.0.0.1:${port}"
+
+assert_has_file $base/oci/org.test.Hello-origin.index.gz
+
+echo "ok app install via bundle"
+
+# Install an updated app bundle with a different origin
+
+make_updated_app oci
+${FLATPAK} build-bundle --repo-url "http://127.0.0.1:${port}" $FL_GPGARGS repos/oci org.test.Hello.flatpak org.test.Hello
+
+${FLATPAK} ${U} install -y --bundle org.test.Hello.flatpak
+
+flatpak remotes -d > remotes-list
+assert_file_has_content remotes-list "^org.test.Hello-origin.*[ ]http://127.0.0.1:${port}"
+
+assert_not_has_file $base/oci/org.test.Hello-origin.index.gz
+
+echo "ok change remote origin via bundle"