Commit Graph

259 Commits

Author SHA1 Message Date
Alexander Larsson
6bb492cb6b test: Suppress weird thread-related stream leak in ostree
Closes: #1966
Approved by: alexlarsson
2018-08-17 08:13:15 +00:00
Alexander Larsson
45945c5d45 tests: Add --gen-suppressions=all to valgrind commandline
Closes: #1964
Approved by: mwleeds
2018-08-13 21:31:09 +00:00
Alexander Larsson
6a551c2ba7 Add suppression for ostree pthread_create issue
It seems like pthread_create allocates some tls that is not
immediately cleaned up. Suppress this for now.

Closes: #1964
Approved by: mwleeds
2018-08-13 21:31:09 +00:00
Owen W. Taylor
90be1f7515 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.
2018-08-13 11:23:28 +02:00
Owen W. Taylor
d7d05a8619 Use oci+http[s]:// as an URL to identify OCI registries
The old pattern of using a separate 'OCI' flag was very ugly
internally in the code once it was extended to flatpak bundles and
flatpakrefs - using a different URI scheme means that the nature
of the remote can't be accidentally lost in some part of the code.

Probing would be possible as well, but would make it difficult to
add a remote when offline, and also doesn't deal well with the
fact that our data layout is different for the two types of remotes -
the type of remote could change at any point!

As a side effect this change enables flatpakrefs and flatpak bundles for OCI
registries.
2018-08-13 11:23:28 +02:00
Alexander Larsson
3fa34ebd8a Work around libsoup recursive type hang in tests
Closes: #1952
Approved by: alexlarsson
2018-08-09 15:45:08 +00:00
Owen W. Taylor
8a32f0e718 Remove FLATPAK_ENABLE_EXPERIMENTAL_OCI envvar check
Now that appstream data and icons are retrievded from the index, the OCI
code is expected to be fully usable, and to work with registries as they
will actually be deployed.

Closes: #1910
Approved by: alexlarsson
2018-08-09 12:49:36 +00:00
Owen W. Taylor
c4c06b7be4 Allow using a compressed cache for HTTP downloads
Add a new flag for flatpak_cache_http_uri() that adds Accept-Encoding: gzip
to the request, and if the result is returned compressed, stores the data
compressed. If the data result is return uncompressed, it's compressed.

Closes: #1910
Approved by: alexlarsson
2018-08-09 12:49:35 +00:00
Owen W. Taylor
6838206e2a test-oci-registry.sh: Tests for talking to an OCI registry
Add a new test case to test the OCI remote functionality. The tests talk to
a server that implements good-enough index generation and bits of the
docker registry protocol. Adding and remove remotes, summary and appstream
generation, and image installation are all tested.

Closes: #1910
Approved by: alexlarsson
2018-08-09 12:49:35 +00:00
Owen W. Taylor
951aed561a Add flatpak_cache_http_uri: cache downloads based on HTTP headers
Add a new function, flatpak_cache_http_uri() that when passed an URL and
a local destination location, either a) downloads the content and stores
it at the destination location, storing HTTP cache header information
like Last-Modified, Etag into user xattrs (if available) or a separate
file or b) if the downloaded content is already present, checks the
header information to decide whether the downloaded content can be used
or needs to be revalidated witha conditional request.

Tests are added that use a special case test server that adds HTTP caching
headers and reacts to them based on query parameters. A small test binary
'httpcache' is added for the tests to use.

Closes: #1910
Approved by: alexlarsson
2018-08-09 12:49:35 +00:00
Owen W. Taylor
83506fa028 test-oci.sh: Remove confusing references to 'registry'
The directory where we export an OCI image to is not a "registry", even
if it's a FlatpakOciRegistry internally. So change export registry from
oci/registry to oci/image.

Closes: #1910
Approved by: alexlarsson
2018-08-09 12:49:35 +00:00
Alexander Larsson
3f4518b15c Run uncrustify
Closes: #1870
Approved by: alexlarsson
2018-07-08 10:05:37 +00:00
Alexander Larsson
c0f9d81fb0 tests: Fix up ioctl suppressions for tests
The FICLONE ioctl suppression was hit via a different
codepath too, so tweak the callstack for the
suppression.
2018-07-07 16:38:24 +02:00
Simon McVittie
3ed522c057 testlibrary: Capture stderr from more commands
This is the equivalent of commit 86fd56dce for the commands added
in commit 2465cf4 to test #1587.

Signed-off-by: Simon McVittie <smcv@debian.org>

Closes: #1864
Approved by: alexlarsson
2018-07-07 08:35:50 +00:00
Simon McVittie
07a225b90e testlibrary: Remove unused argv_str
This was left over after commit 86fd56d.

Signed-off-by: Simon McVittie <smcv@debian.org>

Closes: #1864
Approved by: alexlarsson
2018-07-07 08:35:50 +00:00
Alexander Larsson
fad723dbc4 tests: Run tests on /tmp (not /var/tmp)
Since we now are ok with no-xattrs this means we can run on tmpfs.

Closes: #1839
Approved by: alexlarsson
2018-06-29 09:59:50 +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
Owen W. Taylor
8f73dbd32d Include appstream and icons in OCI bundles as annotations
Include annotations:

 org.freedesktop.appstream.appdata
 org.freedesktop.appstream.icon-{64,128}

into OCI bundles. This not only makes the bundle self-describing, but also
if the bundle is imported into a registry, it becomes possible to browse
the registry and recreate an appstream by only retrieving the annotations
for relevant images, without having to download the actual images.

The icon annotations are formatted as data: URI's with base64 data. The idea
is that a server-side process to collect annotations could extract the icons
to separate storage and rewrite the URI's to remote URL's.

Closes: #1834
Approved by: alexlarsson
2018-06-29 08:43:31 +00:00
Matthew Leeds
85726180a1 tests: Run P2P tests unconditionally
Now that Flatpak always has P2P support enabled, the tests that are
dependent on it can always run.

Closes: #1804
Approved by: alexlarsson
2018-06-20 07:40:53 +00:00
Alexander Larsson
491d174879 Make p2p build non-optional
Closes: #1800
Approved by: alexlarsson
2018-06-19 18:10:56 +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
Simon McVittie
69bc824813 test-webserver.sh: Wait longer for web server to start
When under load (for example running parallel tests) it can take a
while to get the web server ready.

Signed-off-by: Simon McVittie <smcv@collabora.com>

Closes: #1760
Approved by: alexlarsson
2018-06-11 07:38:21 +00:00
Simon McVittie
acb33b4a0e test-webserver: Print http server output
Signed-off-by: Simon McVittie <smcv@collabora.com>

Closes: #1760
Approved by: alexlarsson
2018-06-11 07:38:21 +00:00
Simon McVittie
ea73d96e02 testlibrary: Correct a wrong string in a debug message
This always printed "setting HOME=(null)" because we didn't set
datadir yet, but it should have been looking at homedir anyway.

Signed-off-by: Simon McVittie <smcv@collabora.com>

Closes: #1760
Approved by: alexlarsson
2018-06-11 07:38:21 +00:00
Simon McVittie
2471f0552c testlibrary: Let the test web server's stderr go to the test's stderr
Signed-off-by: Simon McVittie <smcv@collabora.com>

Closes: #1760
Approved by: alexlarsson
2018-06-11 07:38:21 +00:00
Alexander Larsson
376a325eda tests: Test uninstall fail due to dependencies
Closes: #1750
Approved by: alexlarsson
2018-06-01 15:45:08 +00:00
Alexander Larsson
de5a713336 uninstall: Don't allow uninstalling a runtime with apps that need it
Closes: #1750
Approved by: alexlarsson
2018-06-01 15:45:08 +00:00
Alexander Larsson
bc4a2d8dbf uninstall: Add --all
Closes: #1744
Approved by: alexlarsson
2018-06-01 10:59:14 +00:00
Alexander Larsson
715cc173ef Transactions: Add uninstall operation and handle no-pull correctly
In the no-pull case and when uninstalling, we never want to do any network
i/o for e.g. detecting depenedencies.

Closes: #1744
Approved by: alexlarsson
2018-06-01 10:59:14 +00:00
Alexander Larsson
aff4c1f4fc tests: Fix some unused variable errors in non-p2p builds
Closes: #1745
Approved by: alexlarsson
2018-05-31 19:16:15 +00:00
Alexander Larsson
9757e4883e tests: Hacks to handle coreutils-single
In the Fedora 28 base container, `coreutils-single` is used and so
`/usr/bin/ls` is actually a "script":

```
$ file /usr/bin/ls
/usr/bin/ls: a /usr/bin/coreutils --coreutils-prog-shebang=ls script, ASCII text executable
```

We handle this by detecting shebangs in dependencies and recursively adding them.

Closes: #1741
Approved by: alexlarsson
2018-05-31 14:34:49 +00:00
Alexander Larsson
2642b55e91 libflatpak: Guard public headers for individual includes 2018-05-29 16:37:21 +02: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
bad16e2158 test: Add some supressions to fix FLATPAK_TESTS_VALGRIND
Closes: #1720
Approved by: alexlarsson
2018-05-28 10:59:50 +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
Philip Withnall
3902a3fd32 common: Fix setting a collection ID on a repository
It was taking a copy of the repository configuration, modifying the
original repository configuration (not the copy), then saving the copy
to disk.

Add a test.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #1667
Approved by: mwleeds
2018-05-16 04:46:46 +00:00
Matthew Leeds
cdf7c459b8 tests: Forcefully kill the dbus daemon on exit
In the cleanup() function used after each unit test exits, we kill the
dbus daemon process and remove the temporary test directory. However, on
an Endless Mini the daemon doesn't always exit properly before we try to
remove the test directory, leading to an error like:

rm: cannot remove '/var/tmp/test-flatpak-AlmZul/runtime/.dbus-proxy': Device or resource busy

which causes some of the tests to fail with e.g.:

ERROR: tests/test-bundle.sh - exited with status 1

I don't think this is specific to the Mini or to ARM computers; it could
probably happen on any slow computer. So this commit uses "kill -9"
instead of just "kill" to make sure the daemon exits.

Closes: #1642
Approved by: alexlarsson
2018-05-14 07:27:47 +00:00
Simon McVittie
cce2a8dd78 make-test-runtime: Look in /{usr/,}sbin for ldconfig
Under normal circumstances ldconfig isn't required to be in ordinary
users' PATHs, but running this script is not a normal circumstance.

Signed-off-by: Simon McVittie <smcv@collabora.com>

Closes: #1630
Approved by: alexlarsson
2018-05-02 12:25:54 +00:00
Alexander Larsson
30bfc901d5 appstream: Allow system-helper update for local non-gpg remotes
This is safe as we do the pull locally, and root configured the local
path. We already do the same for regular installs, so its weird that
its not done for appstream.

Should fix https://github.com/flatpak/flatpak/issues/1580

Closes: #1585
Approved by: alexlarsson
2018-04-20 10:10:33 +00:00
Alexander Larsson
ef80dd9947 appstream: Update appstream2 branch by default
By default we use the new appstream2 branch if it exists in the remote,
also in this case we compress the xml when deploying to be backwards
compat with the old deploys.

Closes: #1585
Approved by: alexlarsson
2018-04-20 10:10:33 +00:00
Alexander Larsson
7fd085acd7 appstream: Generate appstream2/$arch branches with uncompressed xml
These delta better, and the files will be downloaded as compressed
.filez objects anyway.

Closes: #1585
Approved by: alexlarsson
2018-04-20 10:10:33 +00:00
Matthew Leeds
9afca51507 remote-ls: Allow a URI instead of remote name
This fixes the ability of the remote-ls command to take a file:// URI
instead of a remote name, which is especially useful for repos on USB
drives (created via `ostree create-usb`) which are temporary and don't
warrant being added to the repo config. This commit also updates
relevant documentation, adds a unit test, and updates a few variable
names to improve readability.

I can't find a commit in the history where this was working, but it's
working on the Endless fork of flatpak so I think there was agreement at
some point that it's desired behavior.

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

Closes: #1587
Approved by: mwleeds
2018-04-19 20:59:34 +00:00
Joaquim Rocha
c5e0e97395 lib/installation: Add a method to list remotes by type
Since we have several types of remotes, it is important to have the
option of choosing which types one wants when listing them because
depending on the type it may have an impact in the performance (e.g.
when listing LAN remotes).

For that reason this patch adds a new method
"flatpak_installation_list_remotes_by_type" that allows to specify
which types of remotes should be returned. When giving an empty array
of types, it means that all types should be returned instead, which can
be more useful than actually asserting or not doing anything.

Closes: #1587
Approved by: mwleeds
2018-04-19 20:59:34 +00:00
Joaquim Rocha
33f9029bb1 tests: Cover listing refs from a remote by URL
Listing refs from a remote can be done using a URL so we need to cover
this in the unit tests.

Closes: #1587
Approved by: mwleeds
2018-04-19 20:59:34 +00:00
Joaquim Rocha
2465cf49d4 tests: Cover listing refs with different collection IDs in remotes
This patch tests if refs of different collection IDs are returned
together when listing refs from remote.

Closes: #1587
Approved by: mwleeds
2018-04-19 20:59:34 +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
Alexander Larsson
c33f842b70 lib: Add metadata info in FlatpakRemoteRef
This adds things like the size and the metadata, as well as eol strings
to FlatpakRemoteRef. We typically have this accessible anyway, in the
FlatpakRemoteState.

This makes flatpak_installation_fetch_remote_size/metadata_sync deprecated.

Closes: #1591
Approved by: alexlarsson
2018-04-19 08:17:46 +00:00
Alexander Larsson
534c7a2fc8 tests: Fix unused variable warning in non-p2p case
Closes: #1575
Approved by: alexlarsson
2018-04-16 15:44:06 +00:00
Alexander Larsson
88edfda861 dir: Pass FlatpakRemoteState to flatpak_dir_pull/install/update
Closes: #1575
Approved by: alexlarsson
2018-04-16 15:44:06 +00:00