Commit Graph

86 Commits

Author SHA1 Message Date
Matthias Clasen
ed8fbbe6df testlibrary: Test a few new apis
Closes: #2498
Approved by: matthiasclasen
2019-01-11 18:32:44 +00:00
Alexander Larsson
2a94bb8eb2 Use shorter names for origin remotes
Use only the last section in the id for origin remotes, to avoid
the origin column being really wide when listing stuff.

Closes: #2448
Approved by: alexlarsson
2018-12-20 16:08:44 +00:00
Matthias Clasen
0261fb5d38 Silence compiler warnings
clang was complaining about a number of unused
variables in testlibrary.c. Drop them
2018-12-14 20:56:52 -05:00
Simon McVittie
4c92f5e3c1 testlibrary: Don't leak source IDs
This avoids a crash or deadlock if the timeout is reached during test
teardown, after the GMainLoop has already been freed. That appears to
be more likely to happen when run as an installed-test.

Signed-off-by: Simon McVittie <smcv@collabora.com>
Resolves: https://github.com/flatpak/flatpak/issues/2422

Closes: #2425
Approved by: matthiasclasen
2018-12-12 18:39:12 +00:00
Alexander Larsson
682a93646d tests: Use g_test_dbus in testlibrary
This means we pick up the built services. Also we set
FLATPAK_SYSTEM_HELPER_ON_SESSION so that the system-helper
runs on the session-bus just like in libtest.sh.

Closes: #2397
Approved by: matthiasclasen
2018-12-07 14:45:31 +00:00
Matthias Clasen
9f97b8d414 Fix a few tests
We were relying on the order of string lists obtained
from a keyfile. But the way the keyfile is constructed
involved iterating of hash tables, which doesn't guarantee
order.

This was causing test failures with GLib master.

Closes: #2375
Approved by: matthiasclasen
2018-12-03 20:01:49 +00:00
Simon McVittie
cd63da0cf0 testlibrary: Don't assume native architecture is x86_64
Signed-off-by: Simon McVittie <smcv@debian.org>

Closes: #2353
Approved by: matthiasclasen
2018-11-29 23:01:25 +00:00
Simon McVittie
b8bb44ef40 testlibrary: Use an unusual architecture to test ref syntax parsing
This makes it clearer that we are not assuming that the test is running
on an x86_64.

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

Closes: #2353
Approved by: matthiasclasen
2018-11-29 23:01:25 +00:00
Alexander Larsson
1ce0246b0d dir: Match pre-existing remotes better wrt collection-id
If you have a pre-existing remote configured its exact definition
might differ from the one specified in a flatpakrepo file and yet
be the same.

For example, i have:

$ flatpak --user remotes -d
Name      Title      URL                            Collection ID          Priority Options
flathub   Flathub    https://dl.flathub.org/repo/   org.flathub.Stable     1

Yet when i install a flatpakref:

$ flatpak --user install http://flathub.org/repo/appstream/org.gnome.gedit.flatpakref
The application org.gnome.gedit depends on runtimes from:
  https://dl.flathub.org/repo/
Configure this as new remote 'flathub-1' [y/n]:

Because the flathub flatpakrepo does not yet have the collection id specified.

So, we need to be more lenient when matching the pre-configured remotes.

Closes: #2324
Approved by: alexlarsson
2018-11-16 10:06:22 +00:00
Matthias Clasen
bc04ccbe29 Add another transaction test
Test what happens when a runtime is not available.

Closes: #2252
Approved by: matthiasclasen
2018-10-23 20:10:37 +00:00
Matthias Clasen
daaac92aea tests: Improve the instance test
We now avoid sleeps in the test, instead use the proper
ways to deal with races: poll for the child pid after
launching the app, and use a child watch after killing
it.

This is using the new flatpak_installation_launch_full API.

Closes: #2221
Approved by: matthiasclasen
2018-10-23 07:15:39 +00:00
Matthew Leeds
cffc63ba3a tests: Skip two more tests when bwrap is missing
This adds the logic from test_install_launch_uninstall() to
test_instance() and test_overrides() so that all three are skipped in CI
environments where bwrap may not be working. This is necessary because
they all use flatpak_installation_launch().
2018-10-19 13:45:09 -07:00
Matthias Clasen
fd60bfc96c Add a test for transaction with local install
Here we pass a file url instead of a remote name.

Closes: #2245
Approved by: alexlarsson
2018-10-15 13:39:36 +00:00
Matthias Clasen
dc5d78fa33 Add more tests
The tests added here include checks for expected types in
the library (including enum types that are needed for
introspection), and for error handling around names.

Closes: #2245
Approved by: alexlarsson
2018-10-15 13:39:36 +00:00
Matthias Clasen
acd8cfd6bb Add a test for bad remote names
These were not handled gracefully so far.

Closes: #2244
Approved by: alexlarsson
2018-10-15 06:51:58 +00:00
Matthias Clasen
6d696b74f5 Test more overrides
Test some of the socket settings.

Closes: #2244
Approved by: alexlarsson
2018-10-15 06:51:58 +00:00
Matthias Clasen
5454707464 Add more tests
Test some more instlalation apis, and some error conditions.

Closes: #2244
Approved by: alexlarsson
2018-10-15 06:51:58 +00:00
Matthias Clasen
2ce626b069 Add various new tests
Just driving up coverage incrementally, and finding
bugs along the way.

Closes: #2244
Approved by: alexlarsson
2018-10-15 06:51:58 +00:00
Matthias Clasen
4975840826 Add various new tests
Just driving up coverage incrementally, and finding
bugs along the way.

Closes: #2239
Approved by: alexlarsson
2018-10-12 07:23:45 +00:00
Matthias Clasen
bde3a86333 Adapt tests to the previous commit
One of the transaction tests contains the situation
that was modified in the previous commit. Update it
to expect the new behavior. At the same time, add
some comments to the tests to guide the reader.
2018-10-10 19:26:58 +02:00
Matthias Clasen
03f6b1fcd2 Some test setup fixes
Actually set XDG_RUNTIME_DIR. And assert that the
paths are as we want them to be, from glib's view.

Closes: #2235
Approved by: alexlarsson
2018-10-10 14:42:32 +00:00
Matthias Clasen
10d6330eca tests: Check that updating subpaths works
This test updates an runtime to the same commit, just
changing the subpaths, and makes sure that works as
expected.
2018-10-10 12:21:15 +02:00
Matthias Clasen
c8db26cc35 Make the test app not hang
We want an app that keeps running for some of the
library tests, but other tests expect it to return
right away. Make this opt-in.
2018-10-10 12:21:15 +02:00
Matthias Clasen
d4df921940 Modify the instance test
Avoid the initial sleep statement, and instead poll
for the child pid.

We also need the test app to stick around and not
exit right away, so change it to exec a shell.
2018-10-10 12:21:15 +02:00
Matthias Clasen
60948db6ac Add a test for FlatpakInstance
This shows some shortcomings of the current instance
life-cycle management, with sleeps being necessary
to work around races.
2018-10-10 12:21:15 +02:00
Matthias Clasen
ee9cfde582 fixup! Add a test for related refs
Configure the installation to install de, so we have
a known setup that we can test against.
2018-10-10 12:21:15 +02:00
Matthias Clasen
91f7266f1a Add a test for related refs
Since we have a related ref now, might as well test it.
2018-10-10 12:21:15 +02:00
Matthias Clasen
c7090c5c0b tests: Generate a .Locale extension
Give the test app a Locale extension, so we can test
things around related refs and subpaths. Fix up the
library tests to work with a related ref in the repo.
2018-10-10 12:21:15 +02:00
Matthias Clasen
89545de1f5 Add more library tests
Various new tests, mainly about transaction and remote.
2018-10-10 12:21:15 +02:00
Matthias Clasen
6736c967aa Add a bigger transaction test
This test installs and uninstalls an app using
a transaction, and checks the signals that get
emitted are as expected.

Closes: #2187
Approved by: alexlarsson
2018-10-05 13:34:49 +00:00
Matthias Clasen
e72e0669ce Add some more simple library tests
Simple tests for simple things.

Closes: #2187
Approved by: alexlarsson
2018-10-05 13:34:49 +00:00
Alexander Larsson
6af4d7d3fe tests: Move basic binary list into make-test-runtime.sh
Rather than specify this in multiple places we now list the most
core binaries needed for the tests inside the script.

Closes: #2188
Approved by: alexlarsson
2018-10-05 11:43:12 +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
5ab1b99d62 tests: Run in /tmp
These days we don't really need xattrs for the tests to run,
so move the test runs to /tmp, which brings down make check time
from 5 to 3.5 minutes on my machine.

Closes: #2170
Approved by: alexlarsson
2018-10-03 13:19:35 +00:00
Matthias Clasen
823511b87a Update tests for changed errors
Great that we're actually testing these.

Closes: #2150
Approved by: alexlarsson
2018-10-02 06:21:49 +00:00
Matthias Clasen
3eed1f42a5 Add more tests
Test some more of the FlatpakRef api, including properties.

Closes: #2108
Approved by: alexlarsson
2018-09-24 08:18:10 +00:00
Alexander Larsson
3f4518b15c Run uncrustify
Closes: #1870
Approved by: alexlarsson
2018-07-08 10:05:37 +00: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
491d174879 Make p2p build non-optional
Closes: #1800
Approved by: alexlarsson
2018-06-19 18:10:56 +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
aff4c1f4fc tests: Fix some unused variable errors in non-p2p builds
Closes: #1745
Approved by: alexlarsson
2018-05-31 19:16:15 +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