summaryrefslogtreecommitdiff
path: root/test/containers.c
Commit message (Collapse)AuthorAgeFilesLines
* Disable the Containers interfaceSimon McVittie2021-12-101-0/+2
| | | | | | | | We've had a request for a 1.14.x stable-branch, but the Containers interface is only partially implemented, not yet described in the D-Bus Specification, and not ready to be part of our API guarantees. Signed-off-by: Simon McVittie <smcv@collabora.com>
* containers test: Wait a few more seconds for the socket to be deletedSimon McVittie2018-11-191-0/+8
| | | | | | | | | | | | | | | | Previously, we were waiting a few seconds for the dbus-daemon to stop listening, then trying to connect again and asserting that it failed, then immediately asserting that the socket had actually been deleted. However, there is a race here: the dbus-daemon stops listening on the socket, and then deletes it. If the test client wins the race by probing to see whether the socket is present after the dbus-daemon has stopped listening but before the dbus-daemon has deleted it, then the test will fail. This intermittently happens on Gitlab-CI, most recently in <https://gitlab.freedesktop.org/smcv/dbus/-/jobs/45694>. Signed-off-by: Simon McVittie <smcv@collabora.com>
* containers test: Exercise GetConnectionInstance() on dbus-daemon itselfSimon McVittie2018-08-301-0/+16
| | | | | | | | | This is an easy bit of missing test coverage detected by running the test suite with gcov. Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=107739
* tests: Detach most connections from main loop before closingSimon McVittie2018-08-021-0/+1
| | | | | | | | | We don't need to do this for connections that were never set up with the main loop. Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=107194
* test/containers: Fix some memory leaksSimon McVittie2018-08-021-0/+4
| | | | | | Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=107194
* tests: Call dbus_shutdown()Simon McVittie2018-08-021-0/+1
| | | | | | | | | | Not all of these tests will be fully valgrind-clean yet (or perhaps ever), but it's easier to add this to all of them than to think about it. Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=107194
* containers test: Record the unconfined manager connection's unique nameSimon McVittie2018-06-211-6/+9
| | | | | | | | This is a bit more convenient than fetching it as-needed. Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=105656
* containers test: Factor out fixture_disconnect_observerSimon McVittie2018-06-211-15/+22
| | | | | | Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=105656
* containers test: Factor out disconnecting the unconfined managerSimon McVittie2018-06-211-16/+21
| | | | | | | | | | As this test's coverage expands, this function will have to do more (clear up name watches, filters, etc.) so it'll be helpful to keep it all in one place. Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=105656
* containers test: Move teardown below all test-casesSimon McVittie2018-06-211-53/+53
| | | | | | Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=105656
* Avoid -Wunused-function for iterate_both_main_loops() without containersSimon McVittie2018-03-011-0/+2
| | | | Signed-off-by: Simon McVittie <smcv@collabora.com>
* test/containers: Test the new header fieldSimon McVittie2018-02-161-0/+118
| | | | | | Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101899
* containers: Include credentials of initiator in container instance infoSimon McVittie2018-01-151-8/+35
| | | | | | | | | | This provides the necessary information for services to make an informed decision about how far they should trust the container type, name and metadata fields. Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104610
* test/containers: Don't require type, name in GetConnectionCredentialsSimon McVittie2018-01-151-8/+0
| | | | | | | | | | | On the session bus, the container type and name might be uncontroversial, but on the system bus, it's questionable how far they can be trusted: they're supplied by the initiator of the per-container server, so we only have their word for it. Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=104610
* test/containers: Exercise the resource limitsSimon McVittie2017-12-121-1/+323
| | | | | | Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
* test/containers: Check that GetInstanceInfo stops workingSimon McVittie2017-12-121-0/+31
| | | | | | | | After the container instance is removed, the method should not work. Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
* t/containers: Exercise trivial and non-trivial container metadataSimon McVittie2017-12-121-0/+242
| | | | | | Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
* test/containers: Check that connections from containers are unprivilegedSimon McVittie2017-12-121-0/+13
| | | | | | Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
* test/containers: Check that containers can't make new containersSimon McVittie2017-12-121-0/+65
| | | | | | | | | | | | | | | | We should prevent containers from trying to put a container in our container so we can sandbox while we sandbox. The implementation doesn't actually have any concept of nesting or layering, so that would potentially be privilege escalation. At the moment, this is just prevented by METHOD_FLAG_PRIVILEGED. When we remove that flag (after we've introduced better resource limits), we can specifically restrict this method to not be called by containers instead. This test will make sure we do. Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
* test/containers: Assert that InstanceRemoved is emittedSimon McVittie2017-12-121-2/+108
| | | | | | Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
* test/containers: Exercise the various ways to stop a containerSimon McVittie2017-12-121-2/+347
| | | | | | Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
* test/containers: Exercise connecting to the new socket as the wrong uidSimon McVittie2017-12-121-0/+45
| | | | | | Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
* test/containers: Exercise a successful call to AddServerSimon McVittie2017-12-121-1/+206
| | | | | | Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
* test/containers: Exercise the new parameter checkingSimon McVittie2017-12-111-0/+89
| | | | | | Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354
* test/containers: New testSimon McVittie2017-12-111-0/+157
So far it only exercises SupportedArguments. Signed-off-by: Simon McVittie <smcv@collabora.com> Reviewed-by: Philip Withnall <withnall@endlessm.com> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=101354