summaryrefslogtreecommitdiff
path: root/test/containers.c
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2018-08-03 15:33:08 +0100
committerSimon McVittie <smcv@collabora.com>2018-08-30 17:39:37 +0100
commit488ed14cc0842b2947ed6c44e48d4e736449ef2d (patch)
treef00992b47d565fa27eeca905e251959ad219a7be /test/containers.c
parent10124ae11e348eb3cffc5138d84f489defcbc57b (diff)
downloaddbus-488ed14cc0842b2947ed6c44e48d4e736449ef2d.tar.gz
containers test: Exercise GetConnectionInstance() on dbus-daemon itself
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
Diffstat (limited to 'test/containers.c')
-rw-r--r--test/containers.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/containers.c b/test/containers.c
index 24540051..89898048 100644
--- a/test/containers.c
+++ b/test/containers.c
@@ -1123,6 +1123,22 @@ test_invalid_metadata_getters (Fixture *f,
g_free (error_name);
g_clear_error (&f->error);
+ g_test_message ("Inspecting dbus-daemon");
+ tuple = g_dbus_proxy_call_sync (f->proxy, "GetConnectionInstance",
+ g_variant_new ("(s)", DBUS_SERVICE_DBUS),
+ G_DBUS_CALL_FLAGS_NONE, -1, NULL, &f->error);
+ g_assert_nonnull (f->error);
+ g_assert_null (tuple);
+ error_name = g_dbus_error_get_remote_error (f->error);
+#ifdef DBUS_ENABLE_CONTAINERS
+ g_assert_cmpstr (error_name, ==, DBUS_ERROR_NOT_CONTAINER);
+#else
+ /* TODO: We can use g_assert_error for this when we depend on GLib 2.42 */
+ g_assert_cmpstr (error_name, ==, DBUS_ERROR_UNKNOWN_INTERFACE);
+#endif
+ g_free (error_name);
+ g_clear_error (&f->error);
+
g_test_message ("Inspecting a non-connection");
unique_name = g_dbus_connection_get_unique_name (f->unconfined_conn);
tuple = g_dbus_proxy_call_sync (f->proxy, "GetConnectionInstance",