mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-04 02:50:17 +01:00
config/tests: inject NMDBusManager for tests in NMDevice stub
We don't need the bus for the tests and the manager may warn when it
is not available.
$ (cd src/tests/config/; env -i DBUS_SYSTEM_BUS_ADDRESS=meow ./test-config)
/config/parse-error: OK
/config/no-auto-default: NetworkManager-Message: <info> Could not connect to the system bus; only the private D-Bus socket will be available.
/bin/sh: line 5: 29997 Trace/breakpoint trap ${dir}$tst
FAIL: test-config
This reverts commit 6994454461 for the
most part. It's not sufficient to disable logging warnings. Creating
a DBus Manager might affect the system in undesired ways.
(cherry picked from commit 5040a8a851)
This commit is contained in:
parent
36a136fb58
commit
537ce96fa2
1 changed files with 8 additions and 0 deletions
|
|
@ -28,6 +28,7 @@
|
|||
#include "nm-test-device.h"
|
||||
#include "nm-fake-platform.h"
|
||||
#include "nm-logging.h"
|
||||
#include "nm-dbus-manager.h"
|
||||
|
||||
#include "nm-test-utils.h"
|
||||
|
||||
|
|
@ -289,6 +290,13 @@ main (int argc, char **argv)
|
|||
{
|
||||
nmtst_init_assert_logging (&argc, &argv);
|
||||
|
||||
/* Initialize the DBus manager singleton explicitly, because it is accessed by
|
||||
* the class initializer of NMDevice (used by the NMTestDevice stub).
|
||||
* This way, we skip calling nm_dbus_manager_init_bus() which would
|
||||
* either fail and/or cause unexpected actions in the test.
|
||||
* */
|
||||
nm_dbus_manager_setup (g_object_new (NM_TYPE_DBUS_MANAGER, NULL));
|
||||
|
||||
nm_fake_platform_setup ();
|
||||
|
||||
g_test_add_func ("/config/simple", test_config_simple);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue