Commit Graph

120 Commits

Author SHA1 Message Date
Alexander Larsson
c0d5ee100d tests: Make OCI authenticator available
(cherry picked from commit 4d79110cb6)
2020-06-16 09:48:38 +02:00
Alexander Larsson
86c9e55561 tests: Drop oci label/annotation separate tests
We only do labels now, so no need to test both.
2019-12-19 18:01:00 +01:00
Alexander Larsson
d3c05f052c test: Dist web-server.py 2019-11-27 15:11:15 +01:00
Alexander Larsson
2cb51e5e57 tests: Fix installing org.flatpak.Authenticator.test.service.in 2019-11-26 16:37:01 +01:00
Alexander Larsson
094c1ee0ff tests: Add a test authenticator
This is a trivial implementation of org.freedesktop.Flatpak.Authenticator
that just reads the contents of the "required-token" file and returns
that as the tokens for all refs.
2019-11-26 16:37:01 +01:00
Alexander Larsson
d44864a74e tests: Add p2p token tests
Unfortunately we lose some error information when we pull multiple
refs, ending with a generic "something failed" error rather than the
401 error so in the p2p case we can't verify that we get the right
errors.
2019-11-26 16:37:01 +01:00
Alexander Larsson
f51cb45a4f tests: Add initial tests for token-needing installs 2019-11-26 16:37:01 +01:00
Matthew Leeds
e467695549 tests: Delete test-p2p-security.sh
This test was intended to verify that updates from remote B can't
interfere with updates from remote A even if remote B maliciously sets
the same collection ID as remote A. However, the commits intended to
protect against this turned out to have nasty side effects and need to
be reverted.[1] A subsequent commit will revert the use of
OSTREE_REPO_PULL_FLAGS_MIRROR which means this attack is not exploitable
(since refs will be resolved using a refspec which includes the remote
name), at the cost of not supporting more than one remote having the
same collection ID configured. Since we don't support that, it doesn't
make sense to keep this unit test.

Also, the test seems to be failing.

[1] https://github.com/flatpak/flatpak/issues/3215
2019-11-20 13:17:27 +01:00
Matthias Clasen
caaeb53828 Merge pull request #3169 from smcv/nodist
build: Don't distribute flatpak-portal-dbus.c in tarballs
2019-10-11 08:44:22 -04:00
Simon McVittie
b64cad0f18 build: Don't distribute flatpak-portal-dbus.c in tarballs
Adding generated files to foo_SOURCES causes them to be distributed,
even if that was not intended. Use nodist_foo_SOURCES instead.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-10-11 10:22:08 +01:00
Simon McVittie
8fd5b14d08 build: Don't install test.portal as executable
There's no need for this file to be executable. If it was executed,
shells would typically try to execute it as a shell script (because it
isn't an ELF executable and doesn't start with #!), which isn't going
to work.

Signed-off-by: Simon McVittie <smcv@collabora.com>
2019-10-11 10:17:52 +01:00
Philip Withnall
0975c65574 build: Fix the path to some installed-tests files
Files in the srcdir need to be explicitly prefixed as such in rule
commands. This fixes `make install` when installed-tests are enabled.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-10-10 11:56:28 +01:00
Alexander Larsson
9e9c202afa Fix distcheck 2019-10-02 17:33:08 +02:00
Alexander Larsson
91d9fe9c60 tests: Add simple testing portal backend and wire it up to the tests
This only supports the AccessDialog call, and always just allows
everything. Still, it tests the entire codepath for authentication.
2019-10-02 14:57:11 +02:00
Alexander Larsson
c15c1946ff test: Add test for update-portal monitoring
We add socat to the test runtime, and then we use that to run a
test app outside the sandbox as if it was inside.

The testcase connects creates a monitor and ensure we properly get signals
for updates.
2019-10-02 14:57:11 +02:00
Alexander Larsson
8ab48d5198 tests: Fix whitespace in makefile 2019-10-02 14:57:11 +02:00
Alexander Larsson
9ec61ae328 tests: Add tests for oci registries using labels instead of annotations
Closes: #2978
Approved by: alexlarsson
2019-09-06 12:49:40 +00:00
Debarshi Ray
e82efa8603 Trim unused shared library linkages from the session helper
The org.freedesktop.Flatpak user D-Bus service isn't just used by
flatpak(1) or applications running as Flatpaks. It's also used by
toolbox(1) for similar reasons:
 * To keep various configuration files inside the container
   synchronized with the host
 * To let the container request certain commands to be run on the host

The org.freedesktop.Flatpak D-Bus service itself doesn't need much in
the way of dependencies, but inherits a lot of unused shared library
linkages through the libflatpak-common.la convenience library. Removing
these unused shared libraries reduces the footprint of toolbox(1) for
those who care about such things. eg., Fedora CoreOS.

This commit brings down the number of shared libraries to 19 from 62.

Closes: #3052
Approved by: alexlarsson
2019-08-16 09:13:43 +00:00
Matthew Leeds
6cfad442c5 tests: Add test-p2p-security.sh
This test is meant to test the issue described in the message for the
commit "dir: Use the right keyring to verify P2P pulls".

Closes: #2705
Approved by: alexlarsson
2019-05-09 09:12:26 +00:00
Alexander Larsson
39946c3959 Support .flatpakrepo files in /etc/flatpak/remotes.d
A *.flatpakrepo file in this directory will be automatically
added as a system remote with the basename (sans extension) as the
name unless that name already exist. Also, once this is done we
record the name in the repo config so that it is not applied again if
the remote is removed.

Closes: #2884
Approved by: alexlarsson
2019-05-08 08:13:52 +00:00
Alexander Larsson
894151033f tests: Add tests for client-side filtering
Closes: #2869
Approved by: alexlarsson
2019-05-06 13:58:58 +00:00
Simon McVittie
8115489116 Use system copy of xdg-dbus-proxy for build-time tests if configured
This follows the same logic as the system bwrap.

Otherwise, build-time tests will fail when we are using a system
xdg-dbus-proxy and not compiling our own (the symptom is that testlibrary
hangs).

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

Closes: #2823
Approved by: matthiasclasen
2019-04-15 02:54:51 +00:00
Alexander Larsson
04aece20a3 tests: Add system-norevokefs alternative to check fallback paths
Closes: #2657
Approved by: alexlarsson
2019-04-09 09:18:15 +00:00
Alexander Larsson
42e42ddc86 Pick up the right revokefs-fuse binary
In the normal case, pass the full LIBEXEC path, and in the tests,
pass the path via the env var FLATPAK_REVOKEFS_FUSE.

Closes: #2657
Approved by: alexlarsson
2019-04-09 09:18:15 +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
Matthew Leeds
1ce532dad7 tests: Delete make-test-bundles.sh
This script doesn't work anymore and it's not clear that it's worth
maintaining since no one seems to be using it.

Closes: #2788
Approved by: matthiasclasen
2019-03-30 13:02:10 +00:00
Matthias Clasen
f52d00f391 build-export: Use the icon validator
Validate all exported icons to be loadable png, svg or
jpeg files with a resolution of no more than 512x512.

Closes: #2523
Approved by: alexlarsson
2019-01-17 07:27:31 +00:00
Emmanuele Bassi
4d79e2239a Fix non-srcdir builds
The generated DBus permission header is included by an header in under
app/ that we include from testcommon.c. We already added the app/
directory under the source directory, but we need to include the same
directory under the build directory in order for the compiler to find
the generated header.

Fixes the build in GNOME Continuous, which is failing with:

```
In file included from ../tests/testcommon.c:10:0:
../app/flatpak-builtins-utils.h:28:47: fatal error: flatpak-permission-dbus-generated.h: No such file or directory
compilation terminated.
```
2019-01-11 19:28:30 +00:00
Matthias Clasen
16cf081f97 tests: Add tests for app helpers
Link testcommon against libflatpak-app.la and
add tests for some utility functions.

Closes: #2498
Approved by: matthiasclasen
2019-01-11 18:32:44 +00:00
Matthias Clasen
46e1f8f3b0 Add a test for some private utilities
Add another test that links against libflatpak-common.la
and tests functions that are not part of the public
library api.

Closes: #2498
Approved by: matthiasclasen
2019-01-11 18:32:44 +00:00
Matthias Clasen
6f77da3499 Add some tests for flatpak config
Closes: #2534
Approved by: alexlarsson
2019-01-11 12:40:36 +00:00
Matthias Clasen
4fc5f54075 Add some completion tests
Closes: #2534
Approved by: alexlarsson
2019-01-11 12:40:36 +00:00
Matthias Clasen
456e1d569a tests: Ignore custom repos
I was seeing some issues because make check was
picking up a custom installation that was defined
in /etc/flatpak/installations.d/ on my system.
Avoid that by pointing FLATPAK_CONFIG_DIR at
a non-existing place.

Closes: #2534
Approved by: alexlarsson
2019-01-11 12:40:35 +00:00
Matthias Clasen
77a6665c2f Add some tests for flatpak override
Also test that the overrides have the expected
effect in the sandbox, for some of them.

Closes: #2252
Approved by: matthiasclasen
2018-10-23 20:10:37 +00:00
Matthias Clasen
2d2f35056c Add a test for flatpak info
This exercises the various commandline options.

Closes: #2252
Approved by: matthiasclasen
2018-10-23 20:10:37 +00:00
Matthias Clasen
6b0329bf2d Cosmetic
Closes: #2252
Approved by: matthiasclasen
2018-10-23 20:10:37 +00:00
Matthew Leeds
6710e85d55 tests/Makefile.am.inc: Fix distcleancheck failure 2018-10-19 13:45:22 -07:00
Matthew Leeds
dce3c700ef tests/Makefile.am.inc: Fix distcheck error
Currently `make distcheck` fails with:

PATH=$(cd . && pwd):${PATH} tests/make-test-runtime.sh
tests/runtime-repo org.test.Platform ""
/bin/bash: tests/make-test-runtime.sh: No such file or directory

This was caused by commit b5d86fe90 and is fixed by this commit.
2018-10-19 11:09:34 -07:00
Alexander Larsson
b5d86fe90b tests: Only generate the test platform once
Rather than regenerating it over and over we generate the test
platform as check_DATA and refer to it from the individual tests.
This cuts down "time make check -j8" from 1:25 to 1:06 in user time on
my machine, which is nice in itself, but it is also a stepping stone
for splitting out our large test-scripts into smaller ones where it
will make even more difference.

For the installed-tests case we fall back to creating the platform
once per test.

Closes: #2188
Approved by: alexlarsson
2018-10-05 11:43:12 +00:00
Alexander Larsson
651785c974 tests: Don't dist the .wrap files (as they don't exist) 2018-10-04 11:22:50 +02:00
Alexander Larsson
43c7e7eeec tests: Don't generate the .wrap tests, launch them via test-wrapper.sh
There is no need for these files to be generated on disk

Closes: #2170
Approved by: alexlarsson
2018-10-03 13:19:35 +00:00
Alexander Larsson
5fa3fbf19e tests: Autogenerate test matrix
Several tests have alternative wrappers that just set some feature
flags. For instance to switch between user and system and with or
without deltas. This change makes those wrappers automatically
generated from a simple description of the features.

For example the test-run.sh test goes from:
-       tests/test-run.sh \
-       tests/test-run-system.sh \
-       tests/test-run-deltas.sh \
-       tests/test-run-system-deltas.sh \
to
+       tests/test-run.sh{{user+system},{nodeltas+deltas}} \

There is some complexity here because the TESTS variable in automake
can't be runtime generated, so we rewrite it during "make
update-test-matrix" and commit the result to git.

The way it works is that make update-test-matrix takes the
TEST_MATRIX_SOURCE list, passes it to tests/expand-test-matrix.sh
which generates all the combinations in tests/Makefile-test-matrix.am.inc
where a test like tests/test-foo.sh{user+system} will get
converted to tests/test-foo.sh@user.wrap and tests/test-foo.sh@system.wrap.

We then have a pattern rule matchin tests/*.wrap which will generate
a wrapper that sets the right environment flags based on $0 and then
spawns the wrapper.

Closes: #2170
Approved by: alexlarsson
2018-10-03 13:19:35 +00:00
Simon McVittie
13fee9a9ee tests: Look for httpcache in ${test_builddir}, not PATH
For installed-tests, the installed test directory is not on the PATH.
To make this easier, put the uninstalled binary in tests/, so that
in both build-time and installed tests, it is in ${test_builddir}.

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

Closes: #1989
Approved by: alexlarsson
2018-08-27 10:26:08 +00:00
Simon McVittie
ae0d7943a5 build: Install httpcache if installed-tests are enabled
Signed-off-by: Simon McVittie <smcv@debian.org>

Closes: #1989
Approved by: alexlarsson
2018-08-27 10:26:08 +00:00
Alexander Larsson
3f3625819b Dist tests/oci-registry-[server|client].py
These are needed for make distcheck to pass.
2018-08-20 10:50:57 +02: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
Alexander Larsson
2642b55e91 libflatpak: Guard public headers for individual includes 2018-05-29 16:37:21 +02: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
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