diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2022-12-21 16:58:31 +0100 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2022-12-23 15:57:10 +0100 |
commit | c1d234ce30a301ae9af2462343edf03431608e43 (patch) | |
tree | ef5ec3daf331635201bf57abaa01afe9ed29fa23 | |
parent | 5fe4be6c06b2bcab77741fd77c78be8824bda5a5 (diff) |
libnm/client: fix assertions during device-removed eventbg/libnm
The current implementation of libnm guarantees that "o" and "ao"
properties are cleared when the device object goes away, i.e. when all
its interfaces disappear from the bus.
The "manager:device-removed" signal is emitted just before the device
is unexported, and usually properties are not cleared at that
time. So, the assertions about empty available connections and active
connection during "device-removed" seem wrong; remove them.
Whether the test passes or not depends on a race condition in the way
the mock NM service is stopped: we first close the pipe to the process
to force a clean shutdown (where all objects are orderly unexported)
but just after that we send SIGTERM which causes the service to drop
from the bus.
If libnm sees the service dropping from the bus, it deletes all
objects (thus clearing properties) and then emits
"device-removed"; in this case the test passes.
However in case of a clean shutdown, NM first emits the
"device-removed" signal and then unexports devices, leading to a
failure.
Fixes: aaa9a9cd2566 ('libnm/client: don't reset properties when interface goes away')
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1486
-rw-r--r-- | src/libnm-client-impl/tests/test-nm-client.c | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/src/libnm-client-impl/tests/test-nm-client.c b/src/libnm-client-impl/tests/test-nm-client.c index 5de7c6a5b6..216e3e426c 100644 --- a/src/libnm-client-impl/tests/test-nm-client.c +++ b/src/libnm-client-impl/tests/test-nm-client.c @@ -868,15 +868,7 @@ test_activate_virtual(void) static void _client_dev_removed(NMClient *client, NMDevice *device, int *p_count_call) { - const GPtrArray *arr; - (*p_count_call)++; - - arr = nm_device_get_available_connections(device); - g_assert(arr); - g_assert_cmpint(arr->len, ==, 0); - - g_assert(!nm_device_get_active_connection(device)); } static void |