libnm/client: fix assertions during device-removed event

Merged Beniamino Galvani requested to merge bg/libnm into main

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: aaa9a9cd ('libnm/client: don't reset properties when interface goes away')

Merge request reports