Commit Graph

22 Commits

Author SHA1 Message Date
Alexander Larsson
7043093a5f tests: Avoid unnecessarily recreating the summary file
We enforce --no-update-summary when we create test apps and
runtimes, and then we ensure we always manually call update_repo
after all modifications are done.

This means we save work avoiding summary updates, but it also means we
can do special handling in update_summary and guarantee that this is
the only place this happens. For example, we want this to work around
the mtime handling of summary updates.
2020-11-17 15:20:43 +01:00
Matthew Leeds
e847bb31b6 installation: Re-implement list_installed_refs_for_update()
Re-implement flatpak_installation_list_installed_refs_for_update() using
a FlatpakTransaction, so we can guarantee it always gives the same set
of things to update as the update command. This API is used by GNOME
Software and many times in the past g-s has not shown the same list of
apps to be updated as the flatpak CLI. See:
- https://gitlab.gnome.org/GNOME/gnome-software/issues/539
- https://gitlab.gnome.org/GNOME/gnome-software/-/merge_requests/430

This commit also expands the unit tests for this API, which were already
quite good. Now we test that missing subpaths of locale extensions show
up as updates, and updates that have been pulled but not deployed show
up as well. The latter is a break from how this function used to behave,
but it seems unlikely to break any application.
2020-04-16 09:22:11 +02:00
Alexander Larsson
116a8b8487 transaction: Ensure the metadata in the pulled commit matches what we resolved
We're using the metadata from the summary, ostree-metadata or available
commit when making security sensitive decisions, so lets verify this
matches what we get in the actual commit we pulled.

We already did check that this then actually also matches what gets deployed,
so the new check shares code with that.

Note, we don't do this for OCI installs, because it seems the current
fedora flatpaks don't have this set, and we don't want to break
existing remotes.
2020-03-23 17:58:04 +01:00
Alexander Larsson
b1fdf6c4ef tests: Add and use "ok" helper
This allows us to print some separators for the logs also.

tests: Convert more tests to ok helper
2020-03-20 15:37:10 +01:00
Alexander Larsson
8832e7c7d1 Make test output a bit less noicy
This gets rid of some unnecessary spew that happens in every
test run and just makes the logs harder to read.
2019-10-02 14:57:11 +02:00
Matthew Leeds
0b20f3d48f run: Try to determine the branch if unspecified
Currently when the user doesn't specify a branch to the run command, for
apps it will use the current branch and for runtimes it just tries to
use "master" and fails if that doesn't work. Since runtimes don't have
current branches, it would be nice if we could determine the right one
to use rather than just erroring out. So this commit changes the
implementation so that it looks at each installed runtime and if only
one matches it is used. If there's more than one match the user is
prompted to choose. This is the first interactivity added to the run
command but I don't think that's an issue; any time it's run in a
non-interactive shell it will error out upon encountering ambiguity.

Also, add a couple unit tests for the success path and error paths.

Fixes https://github.com/flatpak/flatpak/issues/2780

Closes: #2788
Approved by: matthiasclasen
2019-03-30 13:02:10 +00:00
Matthew Leeds
3d74d4b37f tests: Add ability to test a branch other than master
This commit makes it so that a unit test can create the test app and
runtime using a branch other than master, and changes test-run.sh to use
the branch "stable". This will allow the run command to be tested better
in the following commit.

Closes: #2788
Approved by: matthiasclasen
2019-03-30 13:02:10 +00:00
Alexander Larsson
df93c9b563 tests: Make make-test-{app,runtime}.sh take repo, not repo name
Later we want to use these outside the test suite, and then we
might not use the same repo naming.

Closes: #2188
Approved by: alexlarsson
2018-10-05 11:43:12 +00:00
Alexander Larsson
aa55665ae1 tests: Don't skip if no user xattrs
We don't require these anymore

Closes: #1839
Approved by: alexlarsson
2018-06-29 09:59:50 +00:00
Alexander Larsson
ffaf2d5386 Cli transaction: Print the full uninstall/install/update lists in ready
This lets you see what operations will happen and you can confirm
it before starting the heavy operations.

Closes: #1797
Approved by: alexlarsson
2018-06-19 08:30:21 +00:00
Alexander Larsson
867d8f4007 tests: We need to update repo with flatpak build-update-repo, not just ostree summary -U
If not, there will not be the flatpak cache in the summary and we'll create a g_warning that
aborts the tests.
2018-05-29 16:37:21 +02:00
Alexander Larsson
45c9fb967a extensions: Respect versions (as well as version) when finding related refs
This allows one extension point to match multiple versions of an extension.
In particular, this is useful for OpenGL so that we can match the version matching the current
runtime, as well as the "magic" 1.4 version for nvidia.

Closes: #1722
Approved by: alexlarsson
2018-05-29 08:01:33 +00:00
Alexander Larsson
fb8122bae2 Tests: Ensure that all ostree commits produce valid bare-user-only repos
In particular the non-canonical checks were failing for me due to selinux
attributes being picked up.

Closes: #1698
Approved by: alexlarsson
2018-05-22 08:28:10 +00:00
Joaquim Rocha
1c8dd13f55 tests: Make the app ID in make-test-app.sh a parameter
This is in order to allow tests to make several apps if needed, and will
be useful when e.g. testing repos that have multiple apps with different
collection IDs.

This patch modifies the mentioned script as mentioned and updates the
places that call it.

Closes: #1587
Approved by: mwleeds
2018-04-19 20:59:34 +00:00
Simon McVittie
22f05803b9 Skip system-mode tests (only) if /var/tmp doesn't support xattrs
This partially reverts commit a53a752a35.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2017-08-31 16:22:18 +02:00
Simon McVittie
a53a752a35 tests: Don't require user xattrs
Since Flatpak 0.9.6, we use libostree in bare-user-only mode, which
does not rely on xattrs.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2017-08-31 13:35:54 +02:00
Philip Withnall
9989188a1e tests: Add support for collection IDs to test-repo.sh
This adds variable support for collection IDs: they can either be
enabled on the server, on the server and client, or not at all. If
enabled on the server, apps and runtimes are built with collection IDs
and the repository has one set. If enabled on the client, the remote
config is added to the local repository with a collection ID and GPG
verification enabled. They are controlled with
USE_COLLECTIONS_IN_{SERVER,CLIENT}={yes,no}.

These variables are used in the new wrapper tests,
test-repo-collections.sh and test-repo-collections-server-only.sh.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2017-08-18 14:23:03 +02:00
Alexander Larsson
99a6200cab tests: Make it possible to create multiple test repos 2017-05-10 11:54:27 +02:00
Alexander Larsson
b8c3b5aa44 Fix tests now that build-init requires the runtime to be installed 2017-01-27 13:56:04 +01:00
Alexander Larsson
0fb2f362a8 tests: Move the test repo to a subdirectory (repos/test)
This makes the ostree trivial-httpd --autoexit feature work better,
because it seems to exit whenever the root directory changes (i.e. not
only when its deleted).

This means the root dir can't be the repo (because then we can't
update the repo), or the base testdir (because we create files there
too), so instead we make the repo $testdir/repos/test and
$testdir/repos as the httpd root.
2017-01-12 00:04:36 +01:00
Alexander Larsson
0be93ed1dc extensions: Always create a tmpfs for subdirectory extensions.
This makes sure we can actually create a directory as needed, and not
having to have every subdirectory pre-created in the runtime.
2016-06-29 15:56:28 +02:00
Alexander Larsson
f1a2f30e41 Add tests for extensions 2016-06-29 12:54:08 +02:00